This is probably dumb but I cannot seem to find words like "wheeled vehicle" via wn.synsets('wheeled vehicle')
(wn
created via from nltk.corpus import wordnet as wn
) --- returns empty array, but I could however find it on the princeton wordnetweb online search
Might anyone know what I'm missing? Or recommend better libraries?
Thanks!
For multi word lemmas, use underscore instead of whitespaces.
>>> 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'
To access the synset directly, you need to know the POS and the lemma index of the synset:
>>> wn.synset('wheeled_vehicle.n.01')
Synset('wheeled_vehicle.n.01')