提取不同情绪的单词影响WordN

2024-09-25 02:34:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着用effect WordNet来表达不同的情绪,比如:愤怒,不喜欢,恐惧,消极恐惧,快乐,悲伤等等

我在库上找到了一个代码示例:https://github.com/clemtoy/WNAffect

from wnaffect import WNAffect
import nltk
nltk.download('dict')

wna = WNAffect('wordnet-1.6/', 'wn-domains-3.2/')
emo = wna.get_emotion('angry', 'JJ')

print(emo)

我测试了一下,得到了一个错误:

Resource dict not found. Please use the NLTK Downloader to obtain the resource:

import nltk nltk.download('dict')

我试着用NLTK下载器下载,但是没有! enter image description here

之前有人问过类似的问题:Extract “emotion words” / affect words from english corpus? 但是他们用sentiwordNet检索正负分,解决了这个问题!在


Tags: thefromimportdownloaddictwordnetwords情绪