2

i wish to get synonyms for small sentences.. How can i do that?

My python code using wordnet is like this:

from nltk.corpus import wordnet as wn
print(wn.synsets('work'))

Then i will get some synonyms returned like this:

employment, work, exercise etc...

But can i get the synonyms for some small sentences like "not working", "not feeling well"

Example i am expecting synonym for "not working" as-- faulty, not functioning etc.. Is there any libraries available to do that? I have tried SimpleNLG. However its not supporting my case.

Chris Pioline
  • 199
  • 1
  • 10

1 Answers1

0

WordNet supports compound words, but they tend to mostly be nouns. E.g. the entry for faulty only has "defective", "imperfect". It does not have "not working", "not functioning".

However, you might be able to use antonyms to find them, and then just put "not" before them? This answer https://stackoverflow.com/a/24199627/841830 shows how to use NLTK to get adjectival antonyms from WordNet.

It is a little risky, because you won't know if "not" is commonly used to negate that adjective, and you may end up with some awkward phrasing. e.g. "not nonabsorbent". (Some corpus analysis could help decide the popularity of compounds you generate from antonyms.)

Darren Cook
  • 27,837
  • 13
  • 117
  • 217