提取“情感词”/影响英语语料库中的单词?

时间:2016-03-03 14:45:39

标签: nltk wordnet

我有很多英语文本,我正在寻找一种方法来提取具有情感内容的词语,例如“愤怒”,“讨厌”,“偏执狂”,“退出”等等。有没有办法用NLTK或WordNet做到这一点?

1 个答案:

答案 0 :(得分:2)

您可以在NLTK中使用SentiWordNet接口来检查英语单词的情感内容。来自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