Sentiment analysis in Python using NLTK

“NLTK, an external library for Python, makes it incredibly easy to utilise natural language processing techniques with only a few lines of code. This, of course, has great use in the fields of predictive modelling, sentiment analysis, speech recognition and more. What follows is a walkthrough of a basic sentiment analyser, written over the course of an evening, with much credit being given to Laurent Luce’s excellent walkthrough that got me up to speed on this stuff very quickly. My analyser, due to scale, doesn’t use a database, but instead reads from a list of positive tweets (postweets.txt) and negative tweets (negtweets.txt) that were created by me. They are as follows:…”