Skip to content

Instantly share code, notes, and snippets.

@maxis1718
Created July 25, 2014 17:13
Show Gist options
  • Save maxis1718/595d66cc62ded2709a01 to your computer and use it in GitHub Desktop.
Save maxis1718/595d66cc62ded2709a01 to your computer and use it in GitHub Desktop.
List similar term using nltk.wordnet
from nltk.corpus import wordnet as wn
for ss in wn.synsets('small'):
print(ss)
for sim in ss.similar_tos():
print(' |--- {}'.format(sim))
## output
Synset('small.n.01')
Synset('small.n.02')
Synset('small.a.01')
|--- Synset('atomic.s.03')
|--- Synset('bantam.s.01')
|--- Synset('bitty.s.01')
...
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment