Extract “emotion words” / affect words from english corpus?

做~自己de王妃 提交于 2019-12-13 02:13:15

问题


I have lots of English language text and am looking for a way to extract the words that have emotional content, such as "anger," "hate," "paranoid," "exited," and so on. Is there a way to do this with NLTK or WordNet?


回答1:


You can use SentiWordNet Interface in NLTK to check for the emotional content of an English word. Usage from NLTK.

>>> from nltk.corpus import sentiwordnet as swn

>>> list(swn.senti_synsets('breakdown'))
[SentiSynset('dislocation.n.02'),
 SentiSynset('breakdown.n.02'),
 SentiSynset('breakdown.n.03'),
 SentiSynset('breakdown.n.04')]

>>> breakdown = swn.senti_synset('breakdown.n.03')
>>> print(breakdown)
<breakdown.n.03: PosScore=0.0 NegScore=0.25>
>>> breakdown.pos_score()
0.0
>>> breakdown.neg_score()
0.25
>>> breakdown.obj_score()
0.75


来源:https://stackoverflow.com/questions/35775282/extract-emotion-words-affect-words-from-english-corpus

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!