module documentation

Undocumented

Function lesk Return a synset for an ambiguous word in a context.
def lesk(context_sentence, ambiguous_word, pos=None, synsets=None): (source) ΒΆ

Return a synset for an ambiguous word in a context.

This function is an implementation of the original Lesk algorithm (1986) [1].

Usage example:

>>> lesk(['I', 'went', 'to', 'the', 'bank', 'to', 'deposit', 'money', '.'], 'bank', 'n')
Synset('savings_bank.n.02')

[1] Lesk, Michael. "Automatic sense disambiguation using machine readable dictionaries: how to tell a pine cone from an ice cream cone." Proceedings of the 5th Annual International Conference on Systems Documentation. ACM, 1986. http://dl.acm.org/citation.cfm?id=318728

Parameters
context_sentenceUndocumented
ambiguous_wordUndocumented
posUndocumented
synsetsUndocumented
iter context_sentenceThe context sentence where the ambiguous word occurs, passed as an iterable of words.
str ambiguous_wordThe ambiguous word that requires WSD.
str posA specified Part-of-Speech (POS).
iter synsetsPossible synsets of the ambiguous word.
Returns
lesk_sense The Synset() object with the highest signature overlaps.