Sentiment Analysis of Trumps Tweets

There are plenty of ways one can go about analyzing the rich recesses in Trumps Twitter archives. Tim, and I wanted to see if sentiment analysis would turn up anything useful. In this short post, we share what was found.

In April 2016, the media repeatedly reported on Trump's warning of a rough July. Trump went so far as to say there could be riots at the Republican National Convention if things didn’t go his way. You mess with Trump's campaign you mess with his staunch supporters.

To be honest, I don’t follow politics closely. These reports and threats were new news. What drew my attention to this tense period in history was the sentiment (read: emotion) in Trump’s tweets during July 2016.


Sentiment analysis (sometimes known as opinion mining or emotion AI) refers to the use of natural language processing, text analysis, computational linguistics, and biometrics to systematically identify, extract, quantify, and study effective states and subjective information. — Wikipedia: Sentiment Analysis

Sentiment analysis is the computational process Timo and Robo used to pull out the views or options held in his tweets. You can imagine why this is a powerful method to apply to text-heavy social media sites like Twitter and Facebook. Take a bunch of tweets from a guy like Trump, and you’re sure to see some extreme spikes across the spectrum of sentiment.

While sentiment analysis is useful, it hasn’t yet evolved to a point where we can capture all the nuanced emotions of our text. To keep the analysis simple and clear, we divided the compound score* into three categories; negative was less than 0% (on a -100% to 100% scale), positive if the tweet had a score higher than 0% and neutral when it equaled 0.


Our sentiment analysis shows that July 2016 is the first point where positive sentiment fell below 50%.


Trump said it would be a rough July, but I doubt he knew just how rough. The United States experienced a series of civilian attacks on police officers and saw terrorism in Florida as well as Nice, France.

What can you reveal in your Tweets or that of your company? Heck, take this analysis and compare it to another active tweeter to see how their sentiment varies. What sort of opinions are new agencies promoting versus universities versus sports team with winning records versus those with losing records?

The questions are endless. Get creative. Have fun!

References & Mentions

Timo loves to talk about sentiment analysis.  You can hit him up at

Stories that unfolded in July 2016:


According to the README file for the vaderSentiment module “The compound score is computed by summing the valence scores of each word in the lexicon, adjusted according to the rules, and then normalized to be between -1 (most extreme negative) and +1 (most extreme positive). This is the most useful metric if you want a single unidimensional measure of sentiment for a given sentence. Calling it a 'normalized, weighted composite score' is accurate.”