本文介绍了提取“情感词",然后/影响英语语料库中的单词?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多英语文字,并且正在寻找一种方法来提取具有情感内容的单词,例如愤怒",仇恨",偏执狂",退出"等等.有没有办法用NLTK或WordNet做到这一点?

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?

推荐答案

您可以使用NLTK中的SentiWordNet接口检查英语单词的情感内容.来自 NLTK 的使用.

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

这篇关于提取“情感词",然后/影响英语语料库中的单词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 16:23