Trump Twitter Sentiment Analyzer
Negative: 0%
Not Sure: 0%
Positive: 0%
  • Connecting to the Twitter Streaming API...
About
The aim of this project was three-fold: (1) To learn how to connect to the public twitter stream using the Node.js ecosystem, (2) To learn how to perform Sentiment Analysis using the Node ecosystem, in order to (3) Generate real-time, echo-chamber free snapshots of world sentiment towards Trump.
To conduct the sentiment analysis I used the Node.js Module Sentiment. Sentiment uses the AFINN-165 wordlist to perform sentiment analysis on arbitrary blocks of input text. The shortcomings of this approach are as follows: (1) A tweet is categorized as positive or negative based on its overall tone, not strictly on whether it is pro or anti Trump, (2) Sarcasm is not recognised, (3) Foreign languages are not recognised. Sentiment gives each tweet a score between -10 and +10 (the higher the score the more positive the sentiment, with 0 counting as neutral). To reduce the amount of false positives I chose to categorize all tweets obtaining a score between -1 and 1 (inclusive) in the 'Not Sure' sentiment category.
To connect to the public twitter stream I used the extremely handy node-twitter module: node-tweet-stream
To enable real-time sending of tweets between the server and web-clients I used the brilliant realtime application framework Socket.io
The map was built using d3.js , thankyou Mike Bostock!
The whole project was inspired by Abhinav Suri's wonderful website to track tweets globally relating to the immigration ban (I appropriated liberally from it). It looks like Abhinav built his project on top of Joel Grus' twitter-globe project, so serious credit must got to Joel on this one. Joel himself appropriated liberally from Mike Bostock's World Tour, so it seems like another round of thanks is due to the master 🙏
Hosted on Heroku