Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Extract the synonyms by using wordnet.
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
You can’t perform that action at this time.