v1

latestOpenAPI 3.0.12026-07-14453659.5 KB
Language Prediction

Prediction for Sentiment

Returns a sentiment prediction for the given string.

post/v2/language/sentiment

Request body

documentstring required

Text for which you want to return a sentiment prediction.

modelIdstring required

ID of the model that makes the prediction. The model must have been created from a dataset with a type of text-sentiment.

numResultsinteger

Number of probabilities to return.

sampleIdstring

String that you can pass in to tag the prediction. Optional. Can be any value, and is returned in the response.

Example request

{
  "document": "I can't tell you how much fun it was",
  "modelId": "WJH4YCA7YX4PCWVNCYNWYHBMY4",
  "numResults": 3
}

Response

Prediction Result

objectstring
sampleIdstring

Value passed in when the prediction call was made. Returned only if the sampleId request parameter is provided.

Example response

{
  "object": "predictresponse",
  "sampleId": "Sample1"
}