Sentiment Analysis
sentiment boolean Default: false
Deepgram’s Sentiment Analysis feature recognizes the sentiment of the entire transcript and detects shifts in sentiment throughout the transcript.
A sentiment of positive, negative, or neutral along with a sentiment_score is identified for each segment of the transcript, and an average of the entire transcript’s sentiment is also provided along with the average sentiment_score.
This sentiment feature produces sentiment analysis at every level of transcription requested, so you’ll get sentiment values for every word, sentence, utterance, and paragraph, in addition to the top-level sentiment for the entire transcription.
The break point for a sentiment_score becoming positive or negative is +-0.333333333....
Enable Feature
To enable Sentiment, use the following parameter in the query string when you call Deepgram’s /listen endpoint:
sentiment=true
To transcribe audio from a file on your computer, run the following curl command in a terminal or your favorite API client.
Replace YOUR_DEEPGRAM_API_KEY with your Deepgram API Key.
Query Parameters
Analyze Response
When the file is finished processing, you’ll receive a JSON response that has the following basic structure:
The sentiment values added to objects are:
sentiment: The sentiment of the associated text (‘positive’ | ‘negative’ | ‘neutral’).sentiment_score: A floating point value between -1 and 1 representing the sentiment of the associated span of text. -1 being the most negative sentiment, and 1 being the most positive sentiment.
Response Properties
API Warning Response
Warning
If you request Sentiment Analysis with an unsupported language by specifying a language code such as sentiment=true&language=es or sentiment=true&detect_language=true where the detected language is unsupported, you will get the warning message below.
Example Warning
Here is an example of the JSON structure of a request with warning object.