Interface UnknownWordModelTrainer

    • Method Detail

      • initializeTraining

        void initializeTraining​(Options op,
                                Lexicon lex,
                                Index<String> wordIndex,
                                Index<String> tagIndex,
                                double totalTrees)
        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.
      • train

        void train​(Collection<Tree> trees)
        Tallies statistics for this particular collection of trees. Can be called multiple times.
      • train

        void train​(Collection<Tree> trees,
                   double weight)
        Tallies statistics for a weighted collection of trees. Can be called multiple times.
      • train

        void train​(Tree tree,
                   double weight)
        Tallies statistics for a single tree. Can be called multiple times.
      • train

        void train​(TaggedWord tw,
                   int loc,
                   double weight)
        Tallies statistics for a single word. Can be called multiple times.
      • incrementTreesRead

        void incrementTreesRead​(double weight)
        Maintains a (real-valued) count of how many (weighted) trees have been read in. Can be called multiple times.
        Parameters:
        weight - The weight of trees additionally trained on
      • finishTraining

        UnknownWordModel finishTraining()
        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