从 semcor 语料库 ( http://www.cse.unt.edu/~rada/downloads.html ) 中,有些感觉没有映射到更高版本的 wordnet。神奇的是,映射可以在 NLTK WordNet API 中找到,如下所示:
>>> from nltk.corpus import wordnet as wn
# Emunerate the possible senses for the lemma 'delayed'
>>> wn.synsets('delayed')
[Synset('delay.v.01'), Synset('delay.v.02'), Synset('stay.v.06'), Synset('check.v.07'), Synset('delayed.s.01')]
>>> wn.synset('delay.v.01')
Synset('delay.v.01')
# Magically, there is a 0th sense of the word!!!
>>> wn.synset('delayed.a.0')
Synset('delayed.s.01')
我检查了代码和API(http://nltk.googlecode.com/svn/trunk/doc/api/nltk.corpus.reader.wordnet.Synset-class.html,http://nltk.org/ _modules/nltk/corpus/reader/wordnet.html),但我找不到他们如何进行不应该存在的神奇映射(例如delayed.a.0
-> delayed.s.01
)。
有谁知道 NLTK Wordnet API 代码的哪一部分做了神奇的映射?