Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit

Previous commit did no work GitHub action on Python3.10.

Git stats


Failed to load latest commit information.
Latest commit message
Commit time


AFINN sentiment analysis in Python: Wordlist-based approach for sentiment analysis.

How to install

>>> git clone
>>> cd afinn
>>> python install


>>> from afinn import Afinn
>>> afinn = Afinn()
>>> afinn.score('This is utterly excellent!')

In Danish:

>>> afinn = Afinn(language='da')
>>> afinn.score('Hvis ikke det er det mest afskyelige flueknepperi...')

In Finnish:

>>> afinn = Afinn(language='fi')
>>> afinn.score('Siellä on uusi hyvä juttu, katsokaa ja kuunnelkaa ihmeessä.')

In Swedish:

>>> afinn = Afinn(language='sv')
>>> afinn.score('det är inte bra')

In Turkish:

>>> afinn = Afinn(language='tr')
>>> from six import u
>>> afinn.score(u('iyi de\u011Fil'))
>>> afinn = Afinn(language='tr')
>>> afinn.score('iyi değil')

With emoticons:

>>> afinn = Afinn(emoticons=True)
>>> afinn.score('I saw that yesterday :)')

With multiple sentences (here with data from an Austen novel available in Gutenberg):

>>> from afinn import Afinn
>>> from nltk.corpus import gutenberg
>>> import textwrap
>>> afinn = Afinn()
>>> sentences = (" ".join(wordlist) for wordlist in gutenberg.sents('austen-sense.txt'))
>>> scored_sentences = ((afinn.score(sent), sent) for sent in sentences)
>>> sorted_sentences = sorted(scored_sentences)
>>> print("\n".join(textwrap.wrap(sorted_sentences[0][1], 70)))
To attach myself to your sister , therefore , was not a thing to be
thought of ;-- and with a meanness , selfishness , cruelty -- which no
indignant , no contemptuous look , even of yours , Miss Dashwood , can
ever reprobate too much -- I was acting in this manner , trying to
engage her regard , without a thought of returning it .-- But one
thing may be said for me : even in that horrid state of selfish vanity
, I did not know the extent of the injury I meditated , because I did
not THEN know what it was to love .


If you as a scientist use the wordlist or the code please cite this one:

  • Finn Årup Nielsen, "A new ANEW: evaluation of a word list for sentiment analysis in microblogs", Proceedings of the ESWC2011 Workshop on 'Making Sense of Microposts': Big things come in small packages. Volume 718 in CEUR Workshop Proceedings: 93-98. 2011 May. Matthew Rowe, Milan Stankovic, Aba-Sah Dadzie, Mariann Hardey (editors)

Paper with supplement:

See also

Travis et al.

Downloads Open Hub