Twitter Brand Sentiment

How do customers perceive your brand? How do you compare to your competition? The Twitter Brand Sentiment app looks at three brands and their sentiment across the US. Install now, change the inputs, and gain insights into your brand against your competitors. Sentiment is measured by #positive/(#positive+#negative), where #positive and #negative is the number of positive and negative words in the tweets. This gives a percentage value that we call Happiness. We base the analysis on a sentiment dictionary from the University of Pittsburgh.

Infographic

The infographic shows:

  • Overall Happiness values for the three different brands as three big numbers in the middle of the map.
  • Overall Happiness values for each city (across all brands) as green bubbles on Seattle, San Francisco, New York, and New Orleans. The larger the bubble, the more happy people are tweeting from that city, independent of the brand.
  • Happiness values by brand for each city. These are four tables next to the cities on the map.
  • Number of positive and negative words by brand for each city. This can be found on the bottom of the infographic in the four bar charts.

Connection and Import

  1. There is one import job per brand per location. You can adjust the import jobs to apply this analysis to different items. It's only a matter of the search query. During configuration of a Twitter import job, you can easily adjust the query. For example, it is currently:

         samsung AND galaxy -iphone -nokia&lang=en&geocode=37.76944,-122.43444,20mi 

    which means: search for recent tweets that contain "samsung" and "galaxy" but not "iphone" or "nokia", that are in English language and within 20mi radius around the latitude longitude values of San Francisco, CA. 
    More information about the Twitter Search API.
  2. The Sentiment Analysis is based on a publicly available sentiment dictionary from the University of Pittsburgh. We put this dictionary on an Amazon S3 instance and pointed the SentimentDictionary import job to it. When this import job is triggered, it pulls the data from there.
  3. We put a small table on S3 that contains longitude and latitude values for the four locations: Seattle, San Franciso, New York, and New Orleans. This is needed by the map widget to plot the bubbles of Happiness values.

Workbook

Computation of all analysis for the infographic is setup in the TwitterBrandSentiment workbook. It imports the prepared tweets from the AllBrandsAllLocations workbook.These are the basic steps of the analysis:

  • Tokenize the tweets to get one row per word in the tweet.
  • Join these tokens with the sentiment dictionary in order to get for each token the information whether it is of positive or negative sentiment.
  • Summarize the data by locations and brands to be able to compute the sentiment values on these granularity levels.
  • Compute the actual sentiment values by the simple formula #positive/(#positive+#negative), where #positive and #negative are the number of positive or negative words in the tweets.