Edukia aztertzeko Adimen Artifiziala

Sentiment Analysis

Analyze the sentiment of a sentence or text in order to characterize it by its overall all emotional charge.

The result of this analysis will show the polarity, valence, and arousal of the overall text, as well as each individual sentence of the text.

The overall sentiment of the text is considered positive when the polarity is between 0.25 and 1.0; neutral when it is between -0.25 and 0.25; and negative when it is between -1 and -0.25.

POST /sentiment-analysis/polarities

Parameters

FieldSourceMandatoryTypeDescription
textBodyStringText to analyze.
typeBodyStringMin, mean, or max values. If this field is not present, mean by default.

Response

CodeName
200OK
400Bad Request
401Unauthorized
429Too Many Requests
500Internal Server Error
curl -X POST "https://api.sherpa.ai/v2/sentiment-analysis/polarities" \
-H  "X-API-Key: XXXX-PUBLIC-API-KEY-XXXX" \
-H  "Content-Type: application/json" \
-d "{\"text\":\"Coronavirus Live Updates: Whistle-Blower Warns of the ‘Darkest Winter in Modern History’ Without Key Changes.
 The Fed warned of long-term pain without urgent intervention.\",\"type\":\"mean\"}"
{
    "document": {
        "polarity": -0.51605,
        "valence": -0.37515,
        "arousal": 0.50285,
        "sentences": [
            {
                "text": "Coronavirus Live Updates: Whistle-Blower Warns of the ‘Darkest Winter in Modern History’ Without Key Changes",
                "polarity": -0.2675,
                "valence": -0.1027,
                "arousal": 0.45499998
            },
            {
                "text": "The Fed warned of long - term pain without urgent intervention .",
                "polarity": -0.7646,
                "valence": -0.6476,
                "arousal": 0.5507
            }
        ]
    }
}