DAT602 – uSense Cognitive Functionality Testing with Node-RED – Sentiment and Tone

As part of the uSense project, we are intending that the device will be able to gauge a person’s mood through the things they say, their facial features, and their social media postings. We can leverage IBM’s Cognitive Services that are provided with IBM Watson.

The relevant services include tone analysis, sentiment analysis, visual recognition, and speech to text.

Having never used this functionality, I decided to create some simple tests using Node-RED and the Watson nodes that are available as plug-ins.

Speech to Text Sentiment Analysis

My first test was with the speech to text functionality. This was done using Node-RED via IBM Bluemix on my laptop.

“The Speech To Text converts the human voice into the written word. This service uses machine intelligence to combine information about grammar and language structure with knowledge of the composition of the audio signal to generate a more accurate transcription.”

This would use my laptop’s built-in microphone to record my voice and then convert what was said to text. This text would then be passed to a sentiment analysis node to determine a basic positive/neutral/negative score.

speech_to_text_node

The results from different spoken words:

“I feel totally stressed today”

I feel very stressed today

“I’m having a fantastic time”

I'm having a fantastic time

“It is 12:43pm”

It is 12:43pm

Tweet Sentiment Analysis

The following flow is similar to the speech to text sentiment analysis flow. This time, I used the Twitter input node to monitor the tweets of a specific user (me):

Edit Twitter input node

Once some text is tweeted, the flow analyses the text of the tweet and scores it, again, with a basic positive/neutral/negative sentiment value.

Tweet sentiment analysis

The results from different tweets:

“I feel very unhappy today”

I feel very unhappy today

Returns a negative sentiment result.

“I feel very happy today”

I feel very happy today

Returns a positive sentiment result.

Tone Analysis

“The Tone Analyzer service uses linguistic analysis to detect emotional tones, social propensities, and writing styles in written communication.”

Tone analysis

The results from two very different sentences:

“I hate you”

I hate you

“I love you”

I love you

As can be seen, ‘anger’ and other negative tones score highly for the first sentence, while ‘joy’ scores highly for the second sentence with the other tones scoring zero.

GitHub

As I have developed these Node-RED flows, I have exported the flows as JSON so that they can be shared and imported by other users.

https://github.com/mfrench71/DAT602

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.