Download & Install
http://wordnet.princeton.edu/wordnet/download/current-version/
파이썬에서는 nltk 라이브러리를 설치하면 기본적으로 설치되어 있다.
NLTK Module Usage
Import python nltk module:
>>> from nltk.corpus import wordnet
Print coordinate terms:
(Coordinate terms are nouns or verbs that have the same hypernym.)
>>> wordnet.synsets("lunch") [Synset('lunch.n.01'), Synset('lunch.v.01'), Synset('lunch.v.02')] >>> lunch_n = wordnet.synset("lunch.n.01") >>> lunch_n.hypernyms() [Synset('meal.n.01')] >>> lunch_n.hypernyms()[0].hyponyms() [Synset('banquet.n.02'), Synset('bite.n.04'), Synset('breakfast.n.01'), Synset('brunch.n.01'), Synset('buffet.n.02'), Synset('dinner.n.01'), Synset('lunch.n.01'), Synset('mess.n.04'), Synset('nosh-up.n.01'), Synset('picnic.n.03'), Synset('ploughman´s_lunch.n.01'), Synset('potluck.n.01'), Synset('refection.n.01'), Synset('square_meal.n.01'), Synset('supper.n.01'), Synset('tea.n.02')] >>> lunch_n.lemmas() [Lemma('lunch.n.01.lunch'), Lemma('lunch.n.01.luncheon'), Lemma('lunch.n.01.tiffin'), Lemma('lunch.n.01.dejeuner')]
>>> lunch_v = wordnet.synset("lunch.v.01") >>> lunch_v.hypernyms() [Synset('eat.v.02')] >>> lunch_v.hypernyms()[0].hypernyms() [Synset('consume.v.02')] >>> lunch_v.hypernyms()[0].hyponyms() [Synset('break_bread.v.01'), Synset('breakfast.v.01'), Synset('brunch.v.01'), Synset('dine.v.01'), Synset('eat.v.01'), Synset('eat_in.v.01'), Synset('eat_out.v.01'), Synset('feast.v.01'), Synset('gorge.v.01'), Synset('lunch.v.01'), Synset('mess.v.01'), Synset('nosh.v.01'), Synset('picnic.v.01'), Synset('take_out.v.12'), Synset('victual.v.03')]
Word relations:
(Antonyms, Derivationally_Related_Forms and Pertainyms are defined only over Lemmas.)
>>> wordnet.synsets("vocal") [Synset('vocal_music.n.01'), Synset('song.n.01'), Synset('vocal.a.01'), Synset('vocal.a.02'), Synset('outspoken.s.01'), Synset('vocal.s.04')] >>> vocal = wordnet.synset("vocal.a.01") >>> vocal.lemmas() [Lemma('vocal.a.01.vocal')] >>> vocal.lemmas()[0].derivationally_related_forms() [Lemma('vocalize.v.02.vocalize')] >>> vocal.lemmas()[0].pertainyms() [Lemma('voice.n.02.voice')] >>> vocal.lemmas()[0].antonyms() [Lemma('instrumental.a.01.instrumental')]
Extract lemma:
(Lemma is the base form(headword; lowercase) for a certain word in dictionary.)
>>> from nltk.stem.wordnet import WordNetLemmatizer >>> WordNetLemmatizer().lemmatize('having','v') 'have'
Synset types
- n: Noun
- v: Verb
- a: Adjective
- s: Adjective Satellite
- r: Adverb
Glossary of terms
http://wordnet.princeton.edu/wordnet/man/wngloss.7WN.html#sect4
Multilingual WordNet
References
- http://wordnet.princeton.edu/
- http://www.nltk.org/
- http://nltk.googlecode.com/svn/trunk/doc/howto/wordnet.html
- http://nltk.googlecode.com/svn/trunk/doc/api/nltk.corpus.reader.wordnet-module.html
- http://compprag.christopherpotts.net/wordnet.html
- WordNets in other languages
- Korean WordNet (KorLex)
- http://ko.wikipedia.org/wiki/%EC%9B%8C%EB%93%9C%EB%84%B7