Giter VIP home page Giter VIP logo

afinn's Introduction

afinn

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

Examples

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

In Danish:

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

With emoticons:

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

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 .

Citation

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: http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/6006/pdf/imm6006.pdf

See also

Travis et al.

image

image

Code issues

Downloads

Open Hub

afinn's People

Contributors

fnielsen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.