Detect the sentiment (positive or negative) of a given text. The entire document is scored and also each individual sentence.
{
"document": {
"sentiment": "positive",
"confidence": 1,
"average_confidence": 1
},
"sentences": [
{
"sentiment": "positive",
"offset": 0,
"confidence": 1,
"length": 34
}
]
} {{ codeCopyText }}
{{ codeCopyText }}
{{ codeCopyText }}
{{ codeCopyText }}
{{ codeCopyText }}
{{ codeCopyText }}
It analyzes a given text to determine whether the sentiment is positive or negative. It provides a score for the entire document as well as for each individual sentence.
The API returns a JSON object containing the sentiment (positive/negative), a confidence score, and an average confidence score for the document, along with a breakdown for each sentence.
Yes, it is perfect for analyzing user reviews, comments, tweets, and other social media content to gauge public opinion and sentiment.
The Detect Sentiment API analyzes the emotion or opinion in the text, whereas the Detect Language API simply identifies which language the text is written in.