如果您查看原始Wordnet搜索并选择"显示选项:显示词汇文件信息",您将看到一个非常有用的词汇分类,称为词汇文件.例如,对于"填充",我们有:
<noun.substance>S: (n) filling, fill (any material that fills a space or container)
<noun.process>S: (n) filling (flow into something (as a container))
<noun.food>S: (n) filling (a food mixture used to fill pastry or sandwiches etc.)
<noun.artifact>S: (n) woof, weft, filling, pick (the yarn woven across the warp yarn in weaving)
<noun.artifact>S: (n) filling ((dentistry) a dental appliance consisting of ...)
<noun.act>S: (n) filling (the act of filling something)
Run Code Online (Sandbox Code Playgroud)
括号中的第一件事是"词法文件".遗憾的是,我无法找到提供此信息的SPARQL端点
Wordnet 3.0 的最新RDF翻译指向两件事: …
from nltk.corpus import wordnet
syn=wordnet.synsets('cookbook')[0]
print syn.definition
Run Code Online (Sandbox Code Playgroud)
预期产出:
'a book of recipes and cooking directions'
Run Code Online (Sandbox Code Playgroud)
实际产量:
bound method Synset.definition of Synset('cookbook.n.01')
Run Code Online (Sandbox Code Playgroud)
我无法查明代码中的错误,这会导致实际输出和预期输出之间的差异.