3

Using NLTK is there a way of getting the word and its POS given the Synset ID?

I have a set if Synset ID and their corresponding domains, I need a way to extract label using the SynsetID Thanks

Ankit

Ankit Solanki
  • 670
  • 2
  • 9
  • 23
  • 1
    possible duplicate of [wordnet - synset offset](http://stackoverflow.com/questions/8077641/wordnet-synset-offset) – alvas Dec 19 '14 at 16:44

1 Answers1

3

Now with nltk 3.2.4 (and probably already a bit before), you can simply use the method synset_from_pos_and_offset(pos, offset) from the nltk.corpus.reader.wordnet module

import nltk
from nltk.corpus import wordnet
wordnet.synset_from_pos_and_offset('n',2403454)
Ortomala Lokni
  • 56,620
  • 24
  • 188
  • 240