Commit 75a201f7 by Steven Bird

new doctest for word sense disambiguation

parent aca50bcc
......@@ -3,9 +3,14 @@
.. -*- coding: utf-8 -*-
==============
=========================
Word Sense Disambiguation
=========================
Lesk Algorithm
==============
--------------
Performs the classic Lesk algorithm for Word Sense Disambiguation (WSD) using
a the definitions of the ambiguous word.
......@@ -14,10 +19,11 @@ Given an ambiguous word and the context in which the word occurs, Lesk returns
a Synset with the highest number of overlapping words between the context
sentence and different definitions form each Synset.
>>> from nltk.wsd import lesk
>>> sent = "I went to the bank to deposit money."
>>> word = "bank"
>>> pos = "n"
>>> print wsd(sent, word, pos)
>>> print lesk(sent, word, pos)
Synset('depository_financial_institution.n.01')
The definitions for "bank" are:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment