Afinn is the simplest yet popular lexicons used for sentiment analysis developed by Finn Årup Nielsen. It contains 3300+ words with a polarity score associated with each word. In python, there is an in-built function for this lexicon.
Let’s see its syntax-
Installing the library:
Code: Python code for sentiment analysis using Affin
topic scores sentiments 0 les gens pensent aux chiens 0.0 neutral 1 i hate flowers -3.0 negative 2 hes kind and smart 3.0 positive 3 we are kind to good people 5.0 positive
The best part of this library package is that one can find score sentiment of different languages as well.
Thus, Afinn can we used easily to get scores immediately.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.