2

I am trying to compare the similarity of two word with w1.wup_similarity(w2) from NLTK. One synonym and the original one if possible.

Yet I don't know how to create w1 and w2. Indeed, according to this tutorial, it seems I need a Synset from the class 'nltk.corpus.reader.wordnet.Synset. Yet when I try to put w1, let say in into a Synset object mode, it only gives me a synonym, inch. I would like to have in :/

Revolucion for Monica
  • 2,848
  • 8
  • 39
  • 78
  • 1
    You asked for `synsets` (pl.) - and you got the list of them. It is up to you which one to select. – DYZ Aug 29 '18 at 14:43
  • @DYZ True ! I updated – Revolucion for Monica Aug 29 '18 at 14:59
  • Please include the complete error message. – DYZ Aug 29 '18 at 15:27
  • Please see https://stackoverflow.com/a/15739472/610569 and https://stackoverflow.com/a/19383914/610569 – alvas Aug 29 '18 at 16:24
  • @DYZ, different synsets for the same word are actually different meanings. – alvas Aug 29 '18 at 16:26
  • @alvas Thanks for the link. I begin to understand. So if I just want the similiarity between a string `in` and synonyms from it to select the one I want to keep I have no options ? – Revolucion for Monica Aug 29 '18 at 16:27
  • Wordnet is indexed on "concept"/"synset" not words. Distance between synsets are clear. But not words/lemma. So if you start with the word/lemma, you have a pre-task of deciding which synset should the word/lemma be before you can get a comparison between two synsets. In short, you get more mileage with word2vec or word embeddings not wordnet if you're working with words/lemmas. – alvas Aug 29 '18 at 16:30
  • @alvas Yes, I work with words indeed and I wanted to get the synonyms of them. But it seems that `wordnet` isn't what will save me indeed as far as I get something that look like `in` (the preposition in, like _I am in the plane_) and I had to reach wordnet.synsets(word)[3] ot get to something like this. Too bad . I will watch the other two packages then. – Revolucion for Monica Aug 29 '18 at 16:39
  • @alvas I know. So what? – DYZ Aug 29 '18 at 16:42

0 Answers0