Skip to main content
Chris Stanley

Real-time Twitter Sentiment App

Foo

Real-time Twitter Sentiment App

Social media sentiment analysis can show data teams what’s being said about a topic, product, service, or even political candidates.

Building and deploying a sentiment analysis application often includes numerous steps of configuration and infra setup. In the example app displayed above, we show you how to get started with sentiment analysis in a few easy steps. The below app is a plug-and-play solution to quickly gather Tweet sentiment values and metadata on any topic. We’ve used these tools to monitor the sentiment of Tweets in the Arizona, Georgia and Pennsylvania Senate races.

In this post we will discuss the following:

  • New real-time and recent historical Twitter sentiment components in the Patterns Marketplace.
  • Our election-tracking data app, which we’ve used to analyze the sentiment of Tweets that mention candidates from several high-profile senate races.

Components

We have developed two components to help data teams quickly gather Tweet text, clean it and run sentiment analysis on it.

The two components offer sentiment analysis on real-time tweets, or a sample of recent historical tweets. Both are capable of returning the results of multiple queries against more than one keyword.

When streaming real time Tweets, the component will analyze and return any that match a list of keywords, as the Tweets are published.

For recent historical tweets, the component will run a search for each keyword or keyphrase in a list.

The sentiment analysis is done by the TextBlob package and returns a tuple of polarity and subjectivity values, alongside Tweet metadata, as a Patterns Table.

High Profile Senate Races

We created an app that tracks the sentiment of Tweets mentioning Democratic and Republican candidates in the Arizona, Georgia and Pennsylvania Senate races.

Using the component that analyzes real-time Tweet sentiment, our data app compares the number of positive and negative tweets mentioning each candidate, as the Tweets are published.

Using the component that analyzes a sample of recent historical tweets, the app also compares Tweet sentiment for each candidate. We did this by finding the sum of Tweet polarity for each candidate, to see if Tweets about them skewed positive or negative.

For nearly all the candidates, Tweets skewed positive, with the exception of Herschel Walker, whose Tweets skewed slightly negative.

We also looked at the sum of polarity across all tweets that mentioned either Republican or Democratic candidates. Tweets mentioning Democrats skewed more positive than tweets mentioning Republicans, but both party’s tweets skewed positive.

Check out our election data app here.

Feel free to fork it to do your own analysis.

As a note: This analysis was run on Oct. 31 to demonstrate the capabilities of the Patterns.app platform. Findings should not be considered conclusive. The Twitter API only draws from Tweets published in the last seven days, when conducting basic Tweet searches, like those in this analysis. Patterns searched for a sample of 50 Tweets for each candidate.