Created
April 28, 2017 07:04
-
-
Save Keiku/ab4efb1863fcce3cb3ac34842d8da545 to your computer and use it in GitHub Desktop.
Extract the synonyms by using wordnet.
This file contains hidden or 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 itertools import chain | |
from nltk.corpus import wordnet | |
synonyms = wordnet.synsets('change') | |
lemmas = set(chain.from_iterable([word.lemma_names() for word in synonyms])) | |
lemmas | |
# Out[31]: | |
# {'alter', | |
# 'alteration', | |
# 'change', | |
# 'commute', | |
# 'convert', | |
# 'deepen', | |
# 'exchange', | |
# 'interchange', | |
# 'modification', | |
# 'modify', | |
# 'shift', | |
# 'switch', | |
# 'transfer', | |
# 'variety', | |
# 'vary'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment