How to compare output of wordnet.synsets?

2019-09-12 11:23发布

问题:

I want compare output from the wordnet.synset function in the NLTK library. In an example when I run:

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

I get output:

output:
        [Synset('dog.n.01'),
     Synset('frump.n.01'),
     Synset('dog.n.03'),
     Synset('cad.n.01'),
     Synset('frank.n.02'),
     Synset('pawl.n.01'),
     Synset('andiron.n.01'),
     Synset('chase.v.01')]

Now if I try:

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

I get output

output: 
[]

How can I compare the outputs in the console to build logic around it? Logic could be "if word not in output then mispelled"

Thank you in advance.