skip to Main Content

Synonyms in Python can be easily found using NLTK or Spacy for a single word like Cat, Dog, Happy, or sad But when it comes to compound words like Artificial- Intelligence or Call-Taxi the language processor always gives output for each and every token instead of giving synonyms for the entire word .i.e Artificial-synoyms-unnatural, feigned, false & Intelligence- intellect, brain, mind. But I need to find synonyms for Artificial Intelligence as a single compound word which should yield a result like robots, system intelligence &, etc. I would be happy if someone provides me a small snippet.

> from nltk.corpus import wordnet as wn print
> wn.synset("eat.v.01").lemma_names # prints synonyms of eat print
> wn.synset("Artificial Intelligence").lemma_names # throws WordNetError

Using Artifical_Intelligence with an underscore also does not work.

2

Answers


  1. As a start point,

    print(wn.synset("artificial_intelligence.n.01").lemma_names())
    

    prints ‘AI’.

    It doesn’t work for "call_taxi" but it can still be interesting for basic usage.

    Login or Signup to reply.
  2. Try using sense2vec, either with one of the pretrained models or training it yourself on a large corpus like Wikipedia. You can check out a demo of it here.

    This won’t work for "call taxi" though, for multi word expressions it only works for noun phrases.

    If you want similar phrases to "call taxi" those wouldn’t be called synonyms, it’s more like a semantic similarity problem, or maybe a paraphrasing problem. Without more context I’m not even sure what you’d want for "call taxi" – "order taxi", "call cab", something like that? That’s a more difficult problem.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search