Skip to main content

How To Use Sentiment Analysis (Beta)


In Beta

This feature is in Beta. If you have questions or comments, email support@symbl.ai.

Process file​

The first thing you need to do before getting your Sentiment Analysis is to process your audio, video, or text file. This code is taken directly from our POST Video URL page. If you want to use an audio or text file you can use the code from the POST Audio URL or POST Text File pages.

caution

You must wait for the job to complete processing before you proceed with getting the Conversation Intelligence. If you immediately make a GET request to Conversation API, it is possible that you'll receive incomplete insights. Therefore, ensure that you wait for the job to complete.

While we provide you with a default video URL for the API to process, which can be downloaded here, you can replace that with any other video URL.

Authentication​

Before using this API, you must generate your authentication token (AUTH_TOKEN). To learn how to get the authentication token, see the Authentication page.

For Node.js sample you need to install the node package request. You can do that via with npm install request.

Request Example​

curl --location --request POST "https://api.symbl.ai/v1/process/video/url" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $AUTH_TOKEN" \
--data-raw '{
"url": "https://symbltestdata.s3.us-east-2.amazonaws.com/sample_video_file.mp4",
"name": "BusinessMeeting",
}'

Response Example​

{
"conversationId": "5815170693595136",
"jobId": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"
}

Receive Sentiment Analysis​

In the response above, you will notice the conversationId field. Using the conversationId you can send a request to GET Speech to Text endpoint, in the Conversation API, which will give you a detailed transcript of the video. Sentiment Analysis also works with the GET Topics endpoint, which gives you information about detected conversational topics in the video. To to get the Sentiment Analysis from the endpoint you must pass the query parameter sentiment=true in the Conversation API URL. Below is an example:

Request Example​

This is example call to the GET Speech to Text endpoint.

curl "https://api.symbl.ai/v1/conversations/$CONVERSATION_ID/messages?sentiment=true" \
-H "Authorization: Bearer $AUTH_TOKEN"

Response Example​

{
"messages":[
{
"id":"6131375637790720",
"text":"Okay, so you're talking about that file, which I am sending you.",
"from":{

},
"startTime":"2021-04-12T22:10:39.881Z",
"endTime":"2021-04-12T22:10:43.981Z",
"conversationId":"6320529160011776",
"phrases":[
{
"type":"action_phrase",
"text":"sending I you"
}
],
"sentiment":{
"polarity":{
"score":-0.201
},
"suggested":"neutral"
}
},
{
"id":"6605033355345920",
"text":"Ah There is way I don't think there is way too now.",
"from":{

},
"startTime":"2021-04-12T22:10:46.681Z",
"endTime":"2021-04-12T22:10:53.281Z",
"conversationId":"6320529160011776",
"phrases":[
{
"type":"action_phrase",
"text":"think there is way too now"
}
],
"sentiment":{
"polarity":{
"score":-0.201
},
"suggested":"neutral"
}
},
...
]
}

Polarity​

In the response you'll notice the polarity field which shows the intensity of the sentiment. It ranges from -1.0 to 1.0, where -1.0 is the most negative sentiment and 1.0 is the most positive sentiment. If you wish to read more about Polarity you can checkout our article on Sentimental Analysis here.

{
"sentiment": {
"polarity": {
"score": 0.6
}
}
}
info

We have chosen the below polarity ranges wrt sentiment type which covers a wide range of conversations. Polarity Sentiment may vary for your use case. We recommend that you define a threshold that works for you, and then adjust the threshold after testing and verifying the results.

polaritySuggested Sentiment
-1.0 => x > -0.3negative
-0.3 => x <= 0.3neutral
0.3 < x <= 1.0positive