Text Emotion Analysis

The Emotion Analysis model will help you understand and interpret emotions in a conversation or text. It is designed to understand human conversation in the form of free text and is designed after the emotion wheel.

Emotion Types

Types of Emotions detected by enabling this model configuration in the Speech Analytics API:

Admiration Amusement Anger Annoyance Approval Caring Confusion Curiosity Desire Disappointment Disapproval Disgust Embarrassment Excitement Fear Gratitude Grief Joy Love Nervousness Optimism Pride Realization Relief Remorse Sadness Surprise Neutral

API Request

Returns the predicted emotion for a given sentence

POST https://api.marsview.ai/text/emotion/get_emotion

Query Parameters

NameTypeDescription

jwtToken*

String

Marsview api access token. You can generate it here: https://docs.marsview.ai/speech-analytics-api/authentication

sentence*

String

The sentence you want to detect emotion

userId*

String

Your Marsview user ID

{
    "status": true,
    "error": {},
    "data": {
        "text": "I love building things that change things",
        "labels": [
            {
                "value": "LOVE",
                "confidence": 0.9979714751243591
            }
        ]
    },
    "userId": "chandra.sekhar@marsview.ai"
}

Example Curl Request

Shown below is a code snippet to send a sample request to the emotion analysis

curl --location --request POST 'https://api.marsview.ai/text/emotion/get_emotion' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jwtToken": "Insert JWT token Key",
    "sentence": "Insert your sentence for emotion detection here",
    "userId"  : "demo@marsview.ai"
}'

Example Response

Shown below is a sample JSON response from the above request.

{
    "status": true,
    "error" : {},
    "data"  : {
        "text": "I love building things that change things",
        "labels": [
            {
                "value": "LOVE",
                "confidence": 0.9979714751243591
            }
        ]
    },
    "userId": "chandra.sekhar@marsview.ai"
}

Response Object

FieldDescription

text

The sentence / phrase for which the emotion is predicted

labels

The emotion labels identified by the models

confidence

Confidence of the predicted emotion

value

The predicted emotion

Last updated