In this blog post, we will show you how to create a social perception dashboard using Watson Tone Analyzer and PubNub FUNCTIONS (BLOCKS) that analyzes and reflects the sentiments of social media users.
Note: This blog post was originally published in the IBM Bluemix Blog
Social media is always buzzing with comments, opinions, rants, and praises about brands, products, events and incidents happening around the world. Analyzing this data can help us build social proof for or against a brand, and this can further help in collective decision making.
Let’s put this in a practical perspective. If you wish to buy a product of a particular company, then chances are that someone would have left feedback about that product on social media.
Similarly, if you plan to attend an ongoing event, then you can already find hashtagged comments about the event that can give you some idea about its popularity. If all of this data is aggregated to build a brand perception index, then that would be an ideal tool for you to make informed decisions amidst this information overloaded world
The source code is split into two components:
The app follows a simple three step process:
As you can see, the Watson Tone Analyzer returns the perception score of five emotions, namely, joy, anger, disgust, fear and sadness. This itself can provide some vivid insights about what people are thinking about these brands.
IBM Watson Tone Analyzer
IBM Watson Tone Analyzer is available as part of the IBM Bluemix catalog of services. Tone Analyzer is built upon a linguistic analysis backend that can sense the emotions of written text or statement. This can help infer the state of the mind of the person who made the statement.Social Perception Comparison based on Twitter
Twitter is one medium which is very quick to soak up all the various thoughts and emotions related to the events happening around the world. Twitter’s restricted format is ideal for analyzing the different emotions expressed by the tweets as can be seen in the demonstration on “how is America feeling right now?” So let’s reframe this question and ask “How do people feel about XYZ brand ?” To answer this question, we can retrieve all the tweets mentioning the brand XYZ. And then, we can follow a series of steps via the Watson Tone Analyzer processing to retrieve and display the analytics centered around the various emotions expressed by the Twitterati.Brandceptions: A brand perception analyzer tool
To take this concept further, we decided to build a tool that can help us with such social perception comparison. Let’s call it “Brandceptions". Using Brandceptions, we can compare two brands, or trending hashtags on Twitter, and get to know the prevailing sentiments expressed by the users around the world. The sentiments are expressed as a probability score of the different emotions that are detected by the Watson Tone Analyzer service. If you want to jump in, just go to the ‘How it Works’ section below. Otherwise, the following section breaks down the components of Brandceptions.Components of Brandceptions
Like most of today’s data driven applications, Brandceptions can also be deployed as a cloud-hosted service on a Web server. There are three external services that it relies on:- Twitter API – To fetch the latest tweet stream mentioning the brands that we want to compare.
- Watson Tone Analyzer Service – To run the sentiment analysis and extract the emotion score.
- PubNub FUNCTIONS(BLOCK) – To process the user requests and orchestrate the data stream containing the response from Watson Tone Analyser.
PubNub Data Stream
This application is powered by PubNub’s realtime data streaming technology. PubNub BLOCK is a component of the PubNub Data Stream network which provides on-the-fly processing of data on the cloud without deploying dedicated server infrastructure.Building the Brandceptions Tool
We have provided the source code of the entire Brandceptions tool for you to try it out. Head over to GitHub to get the source. Here is the deployment view of Brandceptions:- App: The Node.js based WEB SERVER that hosts the Web App. The Web server interfaces with the Twitter stream to extract the tweets relevant to the brands that the user desires to compare.
- Function: The routine that runs on the PubNub FUNCTION. This is where the action happens. All tweets are sent to the Watson Tone Analyzer service, and the emotion score is processed to present to the user.
How it Works
The app can compare two brands and display a simple bar graph of their comparative scores across the five emotions that is predicted by the Watson Tone Analyzer service. Here is a glimpse of the app under operation when we compare two world leader and two upcoming movies:- User enters the two brand names for comparison and Web app sends request to Web server.
The request from Web app to Web server is sent on the PubNub channel ‘realtimebrandmonitor-brands’. - Web server pulls all the latest tweets mentioning the brands and forwards them to BLOCK.
The Web server publishes all the tweets for each brand on the PubNub channel ‘realtimebrandmonitor’. The publish is done as two separate data blobs containing the tweets for each brand. - BLOCK sends all the tweets to Watson Tone Analyzer and collates the result of emotion perception score and sends it back to the web app.
The BLOCK intercepts the tweets from both the bands, gets them analyzed by the Tone Analyzer service and aggregates the result to send it back to the Web app.
Conclusion
Watson Tone Analyzer has a lot of use cases. Not only can it extract the emotional tone of the text, but it is also capable of sensing social and language tone. This can be a great value add for labeling the sentiments of those millions of opinions that people leave on social media about brands. Check out the case studies for Watson Tone Analyzer to know more about its use cases. Coupled with PubNub BLOCKs, we can build some very sophisticated tools by orchestrating the tone analysis results and can also mash-up data from other sources. Check out the PubNub FUNCTION catalog to know more about the other third party services that you can use with it.
Leave a Comment