Using WordNet-Affect with NLTK

669 views Asked by At

I would like to use WordNet-Affect with NLTK. I downloaded WordNet Domains (3.2) which contains a file binding (I thought) the WordNet synset offsets with a category of emotion. Example :

<noun-syn id="n#05574157" categ="weakness"/>

I thought the id property was the synset offset. Then I tried this code:

from nltk.corpus import wordnet as wn

idToSynset = {s.offset():s for s in wn.all_synsets()}
idToSynset[5574157]

But I got a key error... WordNet-Affect was built for WordNet 1.6 but the current version of WordNet is 3.0. It might be the reason why the synset offsets don't match anymore, isn't it? Is it possible to use an old WordNet version in NLTK?

0

There are 0 answers