News

PubNub Sentiment Machine: Real-time Tweet Analysis

1 min read Joe Hanson on Oct 23, 2018
Try PubNub Today

Free up to 1MM monthly messages. No credit card required.

Subscribe to our newsletter

By submitting this form, you are agreeing to our Terms and Conditions and Privacy Policy.

Powered by PubNub, Amazon Comprehend, and Initial State, the real-time dashboard delivers up-to-millisecond analysis based on filtered keywords and topics.

People tweet a lot. And lots of people tweet about things they feel passionately about. It’s easy to sift through a Twitter feed to look at how one person is feeling about a subject. But what about how everyone feels about a subject? That’s a little harder to do.

At PubNub, we sought out the best way to do this analysis at the scale of Twitter. In other words, we wanted to consume the Twitter firehose, filter tweets by subject, analyze the sentiment (emotion), and visualize it on a real-time dashboard.

That’s exactly what we did with our Sentiment Analysis Machine. And the first thing we want to measure is the 2018 Midterms.

To test our machine, we chose to analyze the most polarizing upcoming event we could think of – the 2018 Midterms. The machine tracks dozens of keywords like Midterms, #election, redwave, bluewave, Cruz, Beto, and gauges each Tweet on a scale of 😠to 😁.

How Does It Work?

Sentiment-Machine-Diagram

The application itself is truly real-time, and all processing and analysis, from firehose to dashboard, takes under a second. All messaging runs through PubNub.

  • The PubNub Twitter Firehose pipes in 50 Tweets per second, which are filtered by keywords.
  • Tweets that match one of our selected keywords are processed through the Amazon Comprehend Block, which serverlessly gauges the sentiment of the Tweet.
  • Results are sent in real time to the live-visualization dashboard, powered by Initial State.

Want to check out the code? The full GitHub repo is available here.

More from PubNub

Top Trends to Engage Your App Users
InsightsSep 27, 20224 min read

Top Trends to Engage Your App Users

Take a look at the top trends that are the most effective in attracting customers and reducing churn, and how you can incorporate...

PubNub Staff

PubNub Staff

Comparing Game Engines: Unity vs Unreal vs the Rest
Real-Time Gaming BlogSep 21, 20225 min read

Comparing Game Engines: Unity vs Unreal vs the Rest

Comparing the major game engines: Unity vs Unreal Engine vs Corona SDK vs GameMaker Studio, including the benefits and cons of...

PubNub Staff

PubNub Staff

Python Socket Programming: Client, Server and Peer Libraries
BuildSep 21, 20226 min read

Python Socket Programming: Client, Server and Peer Libraries

Sockets (aka socket programming) enable programs to send and receive data, bi-directionally, at any given moment. This tutorial...

PubNub Staff

PubNub Staff