【问题标题】:how to get synonyms of 2 tokens with wordnet如何使用 wordnet 获取 2 个标记的同义词
【发布时间】:2019-10-29 09:05:50
【问题描述】:
我想获得“项目管理”的确切同义词。我的代码如下:
from nltk.corpus import wordnet
word = wordnet.synsets('project_management')
print(word.lemma_names())
但它不起作用。有什么建议吗?
【问题讨论】:
标签:
python-3.x
nltk
wordnet
【解决方案1】:
WordNet 中没有“项目管理”一词。与此示例比较:
from nltk.corpus import wordnet
word = wordnet.synsets('new_york')
print(word)
print([w.lemma_names() for w in word])
(注意word是一个列表,所以你需要遍历它,即使只有一个synset;你不能直接应用lemma_names()。)
当您不确定问题是您的数据还是您的代码时,您可以使用WordNet web search。