This tool is an implementation of the Twitter Sentiment analysis tool described on Laurent Luce's blog.
- NLTK and its dependencies
You may install NLTK by using pip:
pip install nltk
- Clone this project
- Install NLTK (if it is not installed)
- Run the classifier
Or run the following commands:
git clone git://github.com/victorneo/Twitter-Sentimental-Analysis.git twanalysis
cd twanalysis
pip install nltk
python classification.py
The training data is obtained from the Twitter Search API with the keywords
I am happy
and I am sad
for happy (positive) and sad (negative) tweets.
There is a total of 160 tweets used for training (80 / 80 distribution).
To add more training data, add in new happy tweets to happy.txt
and sad tweets
to sad.txt
using one line for each new tweet.
Test data are separated into happy_test.txt
and sad_test.txt
. A total of
20 tweets are used for test (10 / 10 distribution).
To add more test data, add in new happy tweets to happy_test.txt
and sad
tweets to sad_test.txt
using one line for each new tweet.