This is beginner’s guide to sentiment analysis using Python NLTK on windows. We’ll start w/ installing Python and NLTK and then see how to perform sentiment analysis.
Step 1: Install Python & NLTK
I followed the steps listed on http://nltk.org/install.html
1. Search for python 2.7.3 for windows and install it.
2. Search for Python setup Tools for Windows and install it.
3. Install PIP (for win 64 bit), NLTK and PyYAML.
4. Test installation: Start>All Programs>Python27>IDLE, then type import nltk
Now,
5. Also type:
>>> Import random
6. And also install movie_reviews corpus by typing:
>>>nltk.download()
in the new window that opens, install the movie_reviews corpus.
Step 2: Sentiment Analysis
I followed the code explained in the NLTK book in the section “document classification” in ch 6 learning to classify text. Here is the section: http://nltk.org/book/ch06.html#document-classification
Using the code I was able to run the Naive Bayes Classifier to categorize text:
Conclusion:
In this post, we learned how to perform sentiment analysis using Python on windwos platform. NLTK supports classifiers other than Naive Bayes, and also there are resources that will help you increase the accuracy of the classifier. And I hope that this post acts as a starting guide for you!
Related articles
- Sentiment Analysis using LingPipe on windows 7: (parasdoshi.com)
- Three Data Visualizations I liked this week: (parasdoshi.com)
- Sentiment Analysis in R w/ Twitter data feeds (parasdoshi.com)
- Second Try: Sentiment Analysis in Python : Andy Bromberg (andybromberg.com)
- Sentiment Symposium Tutorial (http://sentiment.christopherpotts.net/)
- What’s “Naive” about Naive Bayes Machine Learning Algorithm? (parasdoshi.com)
0 thoughts on “Beginner’s Guide: Sentiment Analysis using Python on Windows”