Class PredictAPIUtil
- java.lang.Object
-
- net.sf.okapi.connectors.googleautoml.util.PredictAPIUtil
-
public class PredictAPIUtil extends Object
Helper methods for working with the POST /v1beta1/{model_name}:predict endpoint.
-
-
Field Summary
Fields Modifier and Type Field Description static intCONTENT_CHAR_LIMITThe maximum number of characters that can be translated in a single call to the predict endpoint.
-
Constructor Summary
Constructors Constructor Description PredictAPIUtil()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringextractTranslation(InputStream is)Extracts the translation from a stream containing the response body data.List<org.json.simple.JSONObject>getPredictRequests(String sourceText)Given source text of any length, constructs one or more JSONs that can be used as request bodies for the predict endpoint.
-
-
-
Field Detail
-
CONTENT_CHAR_LIMIT
public static final int CONTENT_CHAR_LIMIT
The maximum number of characters that can be translated in a single call to the predict endpoint.- See Also:
- Constant Field Values
-
-
Method Detail
-
getPredictRequests
public List<org.json.simple.JSONObject> getPredictRequests(String sourceText)
Given source text of any length, constructs one or more JSONs that can be used as request bodies for the predict endpoint.
-
extractTranslation
public String extractTranslation(InputStream is) throws org.json.simple.parser.ParseException
Extracts the translation from a stream containing the response body data.- Throws:
org.json.simple.parser.ParseException
-
-