edu.cmu.minorthird.text.learn
Class SequenceAnnotatorLearner

java.lang.Object
  extended by edu.cmu.minorthird.text.learn.AnnotatorLearner
      extended by edu.cmu.minorthird.text.learn.AbstractBatchAnnotatorLearner
          extended by edu.cmu.minorthird.text.learn.SequenceAnnotatorLearner
Direct Known Subclasses:
Recommended.CRFAnnotatorLearner, Recommended.HMMAnnotatorLearner, Recommended.MEMMLearner, Recommended.SVMCMMLearner, Recommended.VPCMMLearner, Recommended.VPHMMLearner

public class SequenceAnnotatorLearner
extends AbstractBatchAnnotatorLearner

Learn an annotation model using a sequence dataset and a BatchSequenceClassifierLearner. This class reduces extraction learning to sequential classification of tokens. The scheme for mapping extraction learning to token learning is determined by the Extraction2TaggingReduction.

Author:
William Cohen

Nested Class Summary
static class SequenceAnnotatorLearner.SequenceAnnotator
           
 
Field Summary
protected  BatchSequenceClassifierLearner seqLearner
           
 
Fields inherited from class edu.cmu.minorthird.text.learn.AbstractBatchAnnotatorLearner
annotationType, fe, reduction, seqData
 
Constructor Summary
SequenceAnnotatorLearner()
           
SequenceAnnotatorLearner(BatchSequenceClassifierLearner seqLearner, SpanFeatureExtractor fe)
           
SequenceAnnotatorLearner(BatchSequenceClassifierLearner seqLearner, SpanFeatureExtractor fe, Extraction2TaggingReduction reduction)
           
 
Method Summary
 Annotator getAnnotator()
          Return the learned annotator.
 boolean getDisplayDatasetBeforeLearning()
          If set, try and pop up an interactive viewer of the sequential dataset before learning.
 java.lang.String getDisplayDatasetBeforeLearningHelp()
           
 BatchSequenceClassifierLearner getSequenceClassifierLearner()
           
 java.lang.String getSequenceClassifierLearnerHelp()
           
static void main(java.lang.String[] args)
           
static SequenceDataset prepareSequenceData(TextLabels labels, java.lang.String spanType, java.lang.String spanProp, SpanFeatureExtractor fe, int historySize, Extraction2TaggingReduction reduction)
          A useful subroutine - prepare sequence data the way a SequenceAnnotatorLearner would prepare it when trained by a TextLabelsAnnotatorTeacher.
 void setDisplayDatasetBeforeLearning(boolean newDisplayDatasetBeforeLearning)
           
 void setSequenceClassifierLearner(BatchSequenceClassifierLearner learner)
           
 
Methods inherited from class edu.cmu.minorthird.text.learn.AbstractBatchAnnotatorLearner
getAnnotationType, getSequenceDataset, getSpanFeatureExtractor, getTaggingReduction, getTaggingReductionHelp, hasNextQuery, nextQuery, reset, setAnnotationType, setAnswer, setDocumentPool, setSpanFeatureExtractor, setTaggingReduction
 
Methods inherited from class edu.cmu.minorthird.text.learn.AnnotatorLearner
getAnnotationTypeHelp, getSpanFeatureExtractorHelp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

seqLearner

protected BatchSequenceClassifierLearner seqLearner
Constructor Detail

SequenceAnnotatorLearner

public SequenceAnnotatorLearner()

SequenceAnnotatorLearner

public SequenceAnnotatorLearner(BatchSequenceClassifierLearner seqLearner,
                                SpanFeatureExtractor fe)

SequenceAnnotatorLearner

public SequenceAnnotatorLearner(BatchSequenceClassifierLearner seqLearner,
                                SpanFeatureExtractor fe,
                                Extraction2TaggingReduction reduction)
Method Detail

getDisplayDatasetBeforeLearning

public boolean getDisplayDatasetBeforeLearning()
If set, try and pop up an interactive viewer of the sequential dataset before learning.


setDisplayDatasetBeforeLearning

public void setDisplayDatasetBeforeLearning(boolean newDisplayDatasetBeforeLearning)

getSequenceClassifierLearner

public BatchSequenceClassifierLearner getSequenceClassifierLearner()

setSequenceClassifierLearner

public void setSequenceClassifierLearner(BatchSequenceClassifierLearner learner)

getDisplayDatasetBeforeLearningHelp

public java.lang.String getDisplayDatasetBeforeLearningHelp()

getSequenceClassifierLearnerHelp

public java.lang.String getSequenceClassifierLearnerHelp()

getAnnotator

public Annotator getAnnotator()
Return the learned annotator.

Specified by:
getAnnotator in class AbstractBatchAnnotatorLearner

prepareSequenceData

public static SequenceDataset prepareSequenceData(TextLabels labels,
                                                  java.lang.String spanType,
                                                  java.lang.String spanProp,
                                                  SpanFeatureExtractor fe,
                                                  int historySize,
                                                  Extraction2TaggingReduction reduction)
A useful subroutine - prepare sequence data the way a SequenceAnnotatorLearner would prepare it when trained by a TextLabelsAnnotatorTeacher.


main

public static void main(java.lang.String[] args)