edu.stanford.nlp.parser.lexparser
Class BaseUnknownWordModelTrainer

java.lang.Object
  extended by edu.stanford.nlp.parser.lexparser.AbstractUnknownWordModelTrainer
      extended by edu.stanford.nlp.parser.lexparser.BaseUnknownWordModelTrainer
All Implemented Interfaces:
UnknownWordModelTrainer
Direct Known Subclasses:
GermanUnknownWordModelTrainer

public class BaseUnknownWordModelTrainer
extends AbstractUnknownWordModelTrainer


Field Summary
 
Fields inherited from interface edu.stanford.nlp.parser.lexparser.UnknownWordModelTrainer
NULL_ITW, nullTag, nullWord, unknown
 
Constructor Summary
BaseUnknownWordModelTrainer()
           
 
Method Summary
protected  UnknownWordModel buildUWM()
           
 UnknownWordModel finishTraining()
          Returns the trained UWM.
 void initializeTraining(Options op, Lexicon lex, Index<java.lang.String> wordIndex, Index<java.lang.String> tagIndex, double totalTrees)
          Initialize the trainer with a few of the data structures it needs to train.
 void train(TaggedWord tw, int loc, double weight)
          Tallies statistics for a single word.
 
Methods inherited from class edu.stanford.nlp.parser.lexparser.AbstractUnknownWordModelTrainer
incrementTreesRead, train, train, train
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseUnknownWordModelTrainer

public BaseUnknownWordModelTrainer()
Method Detail

initializeTraining

public void initializeTraining(Options op,
                               Lexicon lex,
                               Index<java.lang.String> wordIndex,
                               Index<java.lang.String> tagIndex,
                               double totalTrees)
Description copied from interface: UnknownWordModelTrainer
Initialize the trainer with a few of the data structures it needs to train. Also, it is necessary to estimate the number of trees that it will be given, as many of the UWMs switch training modes after seeing a fraction of the trees.
This is an initialization method and not part of the constructor because these Trainers are generally loaded by reflection, and making this a method instead of a constructor lets the compiler catch silly errors.

Specified by:
initializeTraining in interface UnknownWordModelTrainer
Overrides:
initializeTraining in class AbstractUnknownWordModelTrainer

train

public void train(TaggedWord tw,
                  int loc,
                  double weight)
Description copied from interface: UnknownWordModelTrainer
Tallies statistics for a single word. Can be called multiple times.


finishTraining

public UnknownWordModel finishTraining()
Description copied from interface: UnknownWordModelTrainer
Returns the trained UWM. Many of the subclasses build exactly one model, and some of the finishTraining methods manipulate the data in permanent ways, so this should only be called once


buildUWM

protected UnknownWordModel buildUWM()


Stanford NLP Group