News

PubNub Sentiment Machine: Real-time Tweet Analysis

1 min readJoe 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

Can Empathy Exist in the Metaverse
News May 16, 20221 min read

Can Empathy Exist in the Metaverse

A roundtable discussion led by PubNub’s COO, Casey Clegg, exploring the topics of what it means to be human in a virtual world.

PubNub Staff

PubNub Staff

How to Advance Telehealth and Virtual Care Technologies
News May 2, 20221 min read

How to Advance Telehealth and Virtual Care Technologies

Dr. Joe Kvedar, Chair of the Board for the American Telemedicine Association, joins our COO, Casey Clegg, to discuss why...

PubNub Staff

PubNub Staff

Another Step Towards Data Security: ISO-27001 Implementation
BuildMay 2, 20221 min read

Another Step Towards Data Security: ISO-27001 Implementation

Today, we are glad to announce that we are currently in the process of implementing ISO-27001 security standards.

PubNub Staff

PubNub Staff