阿芬情绪分析
afinn的Python项目详细描述
python中的afinn情绪分析:基于wordlist的情绪分析方法。
示例
>>> from afinn import Afinn >>> afinn = Afinn() >>> afinn.score('This is utterly excellent!') 3.0
丹麦语:
>>> afinn = Afinn(language='da') >>> afinn.score('Hvis ikke det er det mest afskyelige flueknepperi...') -6.0
带表情符号:
>>> afinn = Afinn(emoticons=True) >>> afinn.score('I saw that yesterday :)') 2.0
有多个句子(这里有古腾堡奥斯汀小说中的数据):
>>> 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 .
引文
如果您作为一名科学家使用单词表或代码,请引用这一条:
- FinnÅrup Nielsen,“一个新的观点:评价微博中的情感分析词表”,ESWC2011年“理解微观专家”研讨会论文集:大事以小包装出现CEUR研讨会论文集第718卷:93-98。2011年5月马修·罗,米兰·斯坦科维奇,阿巴·萨赫·达齐,玛丽安·哈迪(编辑)
附加纸张:http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/6006/pdf/imm6006.pdf
另请参见
- http://neuro.compute.dtu.dk/wiki/AFINN-Brede关于AFINN的Wiki条目,其中包含指向许多科学论文的指针
- https://github.com/darenr/afinn-使用afinn单词列表进行javascript中的情感分析