Text Sentiment Analysis

Enable this model configuration to analyze text sentiment based on (Lexical Emotion Analysis) is the response inside the sentiment key

Sentiment Analysis will help you interpret and quantify if the conversation or text is Positive, Very Positive, Negative, Very Negative, or Neutral. It also provides you a measure as to how subjective the conversation is with a subjectivity score.

Very Positive

a statement or sentence that is highly positive

"Brilliant work John, you really came through."

Positive

a statement or a sentence that is marginally positive

"Okay let's hope everything is fine."

Neutral

a statement or a sentence that is neutral

"sure I will do that tomorrow"

Negative

a statement or a sentence that is marginally Negative

am not happy with the outcome.."

Very Negative

a statement or sentence that is highly negative

"I don't think that will happen today"

API Request

Returns the predicted sentiment for a given sentence

POST https://api.marsview.ai/text/sentiment/get_sentiment

Query Parameters

NameTypeDescription

jwtToken*

String

sentence*

String

The sentence you want to detect emotion

UserId

String

The Email/ User ID of the user

{
    "status": true,
    "error": {},
    "data": {
        "sentence": "I love building things that change things",
        "avg_sentiment": "Very Positive",
        "avg_polarity": 0.5,
        "avg_subjectivity": 0.6,
        "content": [
            {
                "phrase": "I love building things that change things",
                "sentiment": "Very Positive",
                "polarity": 0.5,
                "subjectivity": 0.6
            }
        ]
    },
    "userId": "chandra.sekhar@marsview.ai"
}

Example Curl Request

Shown below is a code snippet to send a request for the sentiment analysis

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

Example Response

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

{
    "status": true,
    "error": {},
    "data": {
        "sentence": "I love building things that change things",
        "avg_sentiment": "Very Positive",
        "avg_polarity": 0.5,
        "avg_subjectivity": 0.6,
        "content": [
            {
                "phrase": "I love building things that change things",
                "sentiment": "Very Positive",
                "polarity": 0.5,
                "subjectivity": 0.6
            }
        ]
    },
    "userId": "chandra.sekhar@marsview.ai"
}

Response Object

FieldDescription

avgPolarity

Average Polarity score of the given content. This value ranges between -1 and 1. Where -1 is Very negative and 1 is Very positive

avgSentiment

Average predicted sentiment of the given content

avgSubjectivity

Average Subjectivity of the given content

content

A list of sentences / transcriptions for which sentiment has been predicted. This would typically only have one object for real-time analysis

phrase

The sentence for which sentiment has been predicted

polarity

Polarity score of the given content. This value ranges between -1 and 1. Where -1 is Very negative and 1 is Very positive

sentiment

Predicted sentiment of the given content based on the polarity

subjectivity

A scale of how much the sentence is based on facts and figures. A high subjectivity indicates that the information given by the speaker is not based on facts and that it is highly subjective.

sentence

The sentence for which sentiment has been predicted

Last updated