How to get synonyms from nltk WordNet Python

If you want the synonyms in the synset (aka the lemmas that make up the set), you can get them with lemma_names():

>>> for ss in wn.synsets('small'):
>>>     print(ss.name(), ss.lemma_names())

small.n.01 ['small']
small.n.02 ['small']
small.a.01 ['small', 'little']
minor.s.10 ['minor', 'modest', 'small', 'small-scale', 'pocket-size',  'pocket-sized']
little.s.03 ['little', 'small']
small.s.04 ['small']
humble.s.01 ['humble', 'low', 'lowly', 'modest', 'small']    
...

Leave a Comment