How to access the nltk/wordnet Synset object?

nltk, python

Solution

>>> s = wn.synsets('pretty')[0]
>>> s.lemma_names() #call the method to extract list
['pretty']

Note that this gives a list of lemmas; I'm not sure when you'd get multiple, but it seems to be possible.

If you want to find out about other operations on a `Synset`, then call `help` or `dir` on it in the interpreter.

Problem

``` from nltk.corpus import wordnet as wn print (wn.synsets('pretty')[0]) ``` This code returns: Synset('pretty.s.01') However, I can't seem to be able to do anything with this class. Is there anyway to extract the 'pretty.s.01' string from the Synset so that I can compare it in an if statement?

Original source