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.
The results from different spoken words:
“I feel totally stressed today”
“I’m having a fantastic time”
“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):
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.
The results from different tweets:
“I feel very unhappy today”
Returns a negative sentiment result.
“I feel very happy today”
Returns a positive sentiment result.
“The Tone Analyzer service uses linguistic analysis to detect emotional tones, social propensities, and writing styles in written communication.”
The results from two very different sentences:
“I hate 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.
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.