pattern lexicon the pattern package is complete natural language processing framework available in python which can be used for text processingsentiment analysis and more this has been developed by clips (computational linguistics psycholinguistics) research center associated with the linguistics department of the faculty of arts of the university of antwerp pattern uses its own sentiment module which internally uses lexicon which you can access from their official github repository at master/pattern/text/en/en-sentiment xml and this contains the complete subjectivity based lexicon database each line in the lexicon typically looks like the following sample <word form="absurdwordnet_id=" - pos="jjsense="incongruouspolarity="- subjectivity=" intensity=" confidence=" /thus you get important metadata information like wordnet corpus identifierspolarity scoresword sensepos tagsintensitysubjectivity scoresand so on these can in turn be used to compute sentiment over text document based on polarity and subjectivity score unfortunatelypattern has still not been ported officially for python and it works on python howeveryou can still load this lexicon and do your own modeling as needed afinn lexicon the afinn lexicon is perhaps one of the simplest and most popular lexicons that can be used extensively for sentiment analysis developed and curated by finn arup nielsenyou can find more details on this lexicon in the paper by finn arup nielsen" new anewevaluation of word list for sentiment analysis in microblogs"proceedings of the eswc workshop the current version of the lexicon is afinn-en- txt and it contains over , words with polarity score associated with each word you can find this lexicon at the author' official github repository along with previous versions of this lexicon including afinn- at created nice wrapper library on top of this in python called afinn which we will be using for our analysis needs you can import the library and instantiate an object using the following code in [ ]from afinn import afinn afn afinn(emoticons=truewe can now use this object and compute the polarity of our chosen four sample reviews using the following snippet in [ ]for reviewsentiment in zip(test_reviews[sample_review_ids]test_ sentiments[sample_review_ids])print('review:'reviewprint('actual sentiment:'sentimentprint('predicted sentiment polarity:'afn score(review)print('-'* reviewno comment stupid movieacting average or worse screenplay no sense at all skip itactual sentimentnegative