小编Nih*_*Roy的帖子

通过nltk python从wordnet获取上位词

我正在使用此代码查找单词的所有上位词

from nltk import wordnet as wn
for synset in wn.wordnet.synsets('green'):
   for hypernym in synset.hypernyms():
       print synset, hypernym
Run Code Online (Sandbox Code Playgroud)

但这给出了错误:

   File"<stdin>",line 1 in <module>
   File "/usr/local/lib/python 2.7/dist-packages/nltk/corpus/reader/wordnet.py"line 1219 in synset
   lema,pos,synset_index_str=name.lower().rsplit('.',2)
   ValueError: need more than 1 value to unpack
Run Code Online (Sandbox Code Playgroud)

你能建议点什么吗

python nlp nltk wordnet

5
推荐指数
1
解决办法
4306
查看次数

标签 统计

nlp ×1

nltk ×1

python ×1

wordnet ×1