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

时间:2018-04-29 19:09:24

标签: python nlp nltk n-gram synonym

我一直在尝试
关于如何获得我传递的单词的同义词。对于wordnet而言,这是一件容易的事。但是,我尝试使用bigrams进行尝试和失败

  

即'我尝试了“可怕的食物”,“#39;人们去了'

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

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

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

好吧,这个明确的回报ValeError,不知道为什么会这样。

另外,我试过这个:

from nltk.corpus.reader.lin import LinThesaurusCorpusReader as ltcr
synon = ltcr.synonyms(ngram='so horrible')
print(synon)

然后返回TypeError,要求我填写self参数。

0 个答案:

没有答案