Profile

Click to view full profile
Hi, I'm Veerapat Sriarunrungrueang, an expert in technology field, especially full stack web development and performance testing.This is my coding diary. I usually develop and keep code snippets or some tricks, and update to this diary when I have time. Nowadays, I've been giving counsel to many well-known firms in Thailand.
view more...

Thursday, December 23, 2010

Wordnet Interface in Python with NLTK

Currently, my project involves with natural language processing and also wordnet for seeing the relationship between word meanings. In python, wordnet can be used with NLTK. NLTK has a wordnet of Princeton University.The main features that are supported in NLTK as following: synset, lemma, hypernym, hyponym, antonym and path similarity.

Basic use examples:
import nltk
from nltk import wordnet as wn
#looking word's synsets
wn.synsets('beautiful')
#synsets
car = wn.synset('car.n.01')
car.lemmas
car.hypernyms()
car.hyponyms()
#antonyms
car.lemmas[0].antonyms()

See more details at:
http://nltk.googlecode.com/svn/trunk/doc/howto/wordnet.html
http://wordnet.princeton.edu/

No comments:

Post a Comment