Introduction: Senti Lamp
Senti Lamp is a mood light that changes colour depending on the sentiment of tweets with a given keyword, in real-time.
Which problem do we solve?
It's hard to constantly look at your brand's digital Twitter dashboard.
Our solution...
A mood light to display the sentiment of tweets in an unobtrusive way.
How we did it?
With Intel Edison, we stream live Twitter data and deploy a machine learning algorithm to classify the tweets into positive and negative. We then aggregate the sentiment over time and output the value to RGB LED lights to transform it into a colour.
Step 1: Material and Tools
You will need...
Materials:
Intel Edison board
Tools:
Python
node
Step 2: Machine Learning
We train the machine learning algorithm on a laptop using Twitter data already included in Python nltk package. We save the algorithm into a file using pickle and copy it into Edison. We will call this algorithm on Edison to classify the tweets into positive and negative in real time.
The code to train the algorithm, train.py is here:
https://github.com/anna-dz/mood_lamp
Run it just once on your laptop and copy naivebayes.pickle and word_features.pickle files onto Edison.
Step 3: Data Processing on Edison
Code to stream data, calculate a sentiment value and output it into RGB light (and Intel IoT Analytics) is in scrape.py:
Step 4: Front End
We have a website for keyword input (select keyword or hashtag to stream), which also displays some of the incoming tweets. It's hosted on Edison and written in node.js.