这可能是愚蠢的,但我似乎无法找到类似"轮式车辆"通过wn.synsets('wheeled vehicle')
(wn
创建的from nltk.corpus import wordnet as wn
)---返回空数组,但我可以在princeton wordnetweb online search上找到它
有谁知道我错过了什么?或者推荐更好的图书馆?
谢谢!
答案 0 :(得分:2)
对于多字词词条,请使用下划线而不是空格。
>>> from nltk.corpus import wordnet as wn
# Retrieve the synsets that're associated with lemma "wheeled vehicle"
>>> wn.synsets('wheeled_vehicle')
[Synset('wheeled_vehicle.n.01')]
>>> wn.synsets('wheeled_vehicle')[0].definition()
u'a vehicle that moves on wheels and usually has a container for transporting things or people'
要直接访问synset,您需要知道synset的POS和引理索引:
>>> wn.synset('wheeled_vehicle.n.01')
Synset('wheeled_vehicle.n.01')