gov.llnl.ontology.wordnet.wsd
Class SlidingWindowDisambiguation

java.lang.Object
  extended by gov.llnl.ontology.wordnet.wsd.SlidingWindowDisambiguation
All Implemented Interfaces:
WordSenseDisambiguation
Direct Known Subclasses:
LeskWordSenseDisambiguation, PersonalizedPageRankWSD

public abstract class SlidingWindowDisambiguation
extends Object
implements WordSenseDisambiguation

An abstract WordSenseDisambiguation implementation that uses a sliding window of text over the document. The focus word in each window will be disambiguated if it is for a noun, and the word is found in WordNet, otherwise the focus word will be ignored. Subclasses should implement processContext to handle each sliding window context and update the focus word Annotation with a word sense tag.

This class is thread safe.

Author:
Keith Stevens

Constructor Summary
SlidingWindowDisambiguation()
           
 
Method Summary
 Sentence disambiguate(Sentence sentence)
          Returns a new List of s which have word sense labels for each noun found in sentences.
 Sentence disambiguate(Sentence sentence, Set<Integer> focusIndices)
          Returns a new List of Sentences which have word sense labels for each annotation index stored in targetWords.
protected  Synset[] getSynsets(OntologyReader reader, edu.stanford.nlp.pipeline.Annotation annot)
          Returns all of the Synsets found given the word and part of speech information, if present, in annot.
protected abstract  void processContext(edu.stanford.nlp.pipeline.Annotation focus, edu.stanford.nlp.pipeline.Annotation result, Queue<edu.stanford.nlp.pipeline.Annotation> prevWords, Queue<edu.stanford.nlp.pipeline.Annotation> nextWords)
          Processes the local context surrounded focus.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.llnl.ontology.wordnet.wsd.WordSenseDisambiguation
setup
 

Constructor Detail

SlidingWindowDisambiguation

public SlidingWindowDisambiguation()
Method Detail

processContext

protected abstract void processContext(edu.stanford.nlp.pipeline.Annotation focus,
                                       edu.stanford.nlp.pipeline.Annotation result,
                                       Queue<edu.stanford.nlp.pipeline.Annotation> prevWords,
                                       Queue<edu.stanford.nlp.pipeline.Annotation> nextWords)
Processes the local context surrounded focus. This should update focus with any word sense disambiguation Annotations discovered.

Parameters:
focus - The Annotation to disambiguate.
prevWords - The N Annotation words before focus.
nextWords - The N Annotation words after focus.

disambiguate

public Sentence disambiguate(Sentence sentence)
Returns a new List of s which have word sense labels for each noun found in sentences.

Specified by:
disambiguate in interface WordSenseDisambiguation

disambiguate

public Sentence disambiguate(Sentence sentence,
                             Set<Integer> focusIndices)
Returns a new List of Sentences which have word sense labels for each annotation index stored in targetWords.

Specified by:
disambiguate in interface WordSenseDisambiguation

getSynsets

protected Synset[] getSynsets(OntologyReader reader,
                              edu.stanford.nlp.pipeline.Annotation annot)
Returns all of the Synsets found given the word and part of speech information, if present, in annot. If the part of speech is available, but provides no synsets, all possible synsets are returned for the word, under the assumption that the tag may be incorrect.



Copyright © 2010-2011. All Rights Reserved.