Kap*_*ngh 3 python nltk wordnet
我试图找到一种方法来从 NLTK 的 WordNet 中获取给定单词的定义。我尝试了以下代码,但出现错误,提示“WordNetCorpusReader”对象没有“定义”属性:
from nltk.corpus import wordnet
definition = wordnet.definition('game')
print(definition)
Run Code Online (Sandbox Code Playgroud)
我试图查看许多书籍,但没有找到相关信息。
小智 5
看看https://pythonprogramming.net/wordnet-nltk-tutorial/,我认为答案是:
from nltk.corpus import wordnet
syns = wordnet.synsets("game")
print(syns[0].definition())
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3416 次 |
| 最近记录: |