如何在nltk Python中使用sentiwordnet获取ngram的同义词

2024-04-29 12:46:56 发布

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

我一直在尝试
关于如何获得我通过的单词的同义词。对于wordnet来说,这是一件容易的事。但是我在尝试和失败

viz. 'i tried', 'horrible food', 'people go'

我找了这些
为了了解更多关于sentiwordnet的信息,我读了documentation。也许,没有关于如何使用它的例子。 也去了source,但我在这里。在

我写了
在foll中执行此操作的代码。好吧,指出需要纠正的地方:

from nltk.corpus import sentiwordnet as swn
sentisynset = swn.senti_synset('so horrible')
print(sentisynset)

好吧,这个clear返回ValeError,但不知道为什么。在

我也试过了:

^{pr2}$

这将返回TypeError,要求我填充self参数。在


Tags: 信息gofooddocumentationpeople单词wordnet例子