Detect Sentiment API

Detect the sentiment (positive or negative) of a given text. The entire document is scored and also each individual sentence.

GET
https://api.apileague.com/detect-sentiment
Example Request and Response
GET
https://api.apileague.com/{{ examples.getDetectSentiment }}
{
    "document": {
        "sentiment": "positive",
        "confidence": 1,
        "average_confidence": 1
    },
    "sentences": [
        {
            "sentiment": "positive",
            "offset": 0,
            "confidence": 1,
            "length": 34
        }
    ]
}
cURL
Java
Javascript
Python
Go
C#
 {{ codeCopyText }}
 {{ codeCopyText }}
 {{ codeCopyText }}
 {{ codeCopyText }}
 {{ codeCopyText }}
 {{ codeCopyText }}

Frequently Asked Questions

What does the Detect Sentiment API do?

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.

What kind of output does the API return?

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.

Can this API be used for social media monitoring?

Yes, it is perfect for analyzing user reviews, comments, tweets, and other social media content to gauge public opinion and sentiment.

How is the Detect Sentiment API different from the Detect Language API?

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.

Questions? Need Help? Ask Away