daniels daniels - 7 months ago 11
Python Question

Is there any lib for python that will get me the synonyms of a word?

Is there any api/lib for python that will get me the synonyms of a word?

For example if i have the word "house" it will return "building, domicile, mansion, etc..."

Answer

NLTK and Wordnet can help: e.g., per this article,

from nltk.corpus import wordnet

dog = wordnet.synset('dog.n.01')
print dog.lemma_names

prints:

['dog', 'domestic_dog', 'Canis_familiaris']
Comments