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.
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.
Before using the Async API you must get the authentication token (
AUTH_TOKEN) from our authentication process.
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:
This is example call to the GET Speech to Text endpoint.
In the response you'll noitice 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.
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.
|-1.0 => x > -0.3||negative|
|-0.3 => x <= 0.3||neutral|
|0.3 < x <= 1.0||positive|