0

I am new to NLP, NLTK and Python. I am using wordnet to get the synonyms for a word in given sentence. I am using the below code to get the synonyms and lemma names of those words

synonyms = wordnet.synsets(w,pos)
lemmas.append(list( set(chain.from_iterable([w.lemma_names() for w in synonyms]))))

eg : wordnet.synsets("get",'v')

The lemma_names for this word "get" returns many things which are irrelevant for me.

My search string is "error getting the report". lemma_names has even "buzz off", "gets under one's skin" which are not correct for my statement.

So is there a way get synonyms which are relevant to the statement? is there any concept or algorithms that I can check for?

amoolya
  • 23
  • 5
  • See https://stackoverflow.com/questions/19348973/all-synonyms-for-word-in-python Ironically, wordnet is indexed by "synsets"/concepts and not words. So word-to-word relations (synonyms, hyper-/hyponyms, etc.) are not directly encoded in Wordnet. Only concept-to-concept relations are directly available through the wordnet. – alvas Jan 14 '19 at 08:22
  • so is there any other package which gives this? – amoolya Jan 15 '19 at 06:29
  • Ask yourself the question (as a linguist/human) does word themselves have meaning away from a concept? Lets say you and I both have a box with a beetle in it. I say I have a beetle in a box and you can't see it, my beetle is not the same as yours but do we really think that what's in the box is a beetle in the same manner? – alvas Jan 15 '19 at 11:39

0 Answers0