WorldMood is a real-time Twitter sentiment analysis classifier and analyzer that I created for my dissertation in 2014. It is composed of multiple components that each constitute the entire stream pipeline, from fetching a tweet from twitter, to classifying it using a trained classifier, to displaying it on the front-end.

The streamer component of worldmood is responsible for consuming a Twitter Stream filtering by a specific term that the user gives. Tweets are then sanitized, filtered, and sent to the classifier using ZeroMQ.

The classifier component is written in Python and uses the NLTK library to break a tweet into tokens (bag-of-words approach) and is then classified using a Naive Bayes classifier. I only support 2 sentiments: “positive” and “negative”. The classifier component is built to scale horizontally thanks to ZeroMQs round-robin load balancing. Classified tweets are then sent to the web application back-end with all their metadata.

The Web Application backend is written in NodeJS, it receives classified tweets and forwards them to the web applications connected using websockets. The front-end is built on top of a BackboneJS single-page app and is completely real-time. The most accurate tweets are displayed on the left side while on the right side charts are plotted containing accuracy and sentiment metrics.

WorldMood

The entire project has been open sourced, including the trained classifiers and the training scripts. I’m also proud to say that this project has an excellent test coverage, both on the back-end and on the front-end.

Do you like project? I do too! and have some really interesting ideas to share and to make it grow, so please contact me and I’d love to have a chat with you.