Created
July 25, 2014 17:13
-
-
Save maxis1718/595d66cc62ded2709a01 to your computer and use it in GitHub Desktop.
List similar term using nltk.wordnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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