opennlp.tools.ml

## Class AbstractEventTrainer

- java.lang.Object
- - opennlp.tools.ml.AbstractTrainer
  - - opennlp.tools.ml.AbstractEventTrainer

- All Implemented Interfaces:
    EventTrainer
  Direct Known Subclasses:
    GISTrainer, NaiveBayesTrainer, PerceptronTrainer, QNTrainer

      public abstract class AbstractEventTrainer
      extends AbstractTrainer
      implements EventTrainer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DATA_INDEXER_ONE_PASS_REAL_VALUE`
    `static String` | `DATA_INDEXER_ONE_PASS_VALUE`
    `static String` | `DATA_INDEXER_PARAM`
    `static String` | `DATA_INDEXER_TWO_PASS_VALUE`

    - ### Fields inherited from class opennlp.tools.ml.AbstractTrainer

      `ALGORITHM_PARAM, CUTOFF_DEFAULT, CUTOFF_PARAM, ITERATIONS_DEFAULT, ITERATIONS_PARAM, TRAINER_TYPE_PARAM, VERBOSE_DEFAULT, VERBOSE_PARAM`

    - ### Fields inherited from interface opennlp.tools.ml.EventTrainer

      `EVENT_VALUE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractEventTrainer()`
    `AbstractEventTrainer(TrainingParameters parameters)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract MaxentModel` | `doTrain(DataIndexer indexer)`
    `DataIndexer` | `getDataIndexer(ObjectStream<Event> events)`
    `abstract boolean` | `isSortAndMerge()`
    `boolean` | `isValid()` Deprecated.
    `MaxentModel` | `train(DataIndexer indexer)`
    `MaxentModel` | `train(ObjectStream<Event> events)`
    `void` | `validate()` Check parameters.

    - ### Methods inherited from class opennlp.tools.ml.AbstractTrainer

      `getAlgorithm, getCutoff, getIterations, init, init`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface opennlp.tools.ml.EventTrainer

      `init, init`

- - ### Field Detail

    - #### DATA_INDEXER_PARAM

          public static final String DATA_INDEXER_PARAM

      See Also:
        Constant Field Values

    - #### DATA_INDEXER_ONE_PASS_VALUE

          public static final String DATA_INDEXER_ONE_PASS_VALUE

      See Also:
        Constant Field Values

    - #### DATA_INDEXER_TWO_PASS_VALUE

          public static final String DATA_INDEXER_TWO_PASS_VALUE

      See Also:
        Constant Field Values

    - #### DATA_INDEXER_ONE_PASS_REAL_VALUE

          public static final String DATA_INDEXER_ONE_PASS_REAL_VALUE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AbstractEventTrainer

          public AbstractEventTrainer()

    - #### AbstractEventTrainer

          public AbstractEventTrainer(TrainingParameters parameters)

  - ### Method Detail

    - #### validate

          public void validate()

      Description copied from class: `AbstractTrainer`
      Check parameters. If subclass overrides this, it should call super.validate();
      Overrides:
        `validate` in class `AbstractTrainer`

    - #### isValid

          @Deprecated
          public boolean isValid()

      Deprecated.
      Overrides:
        `isValid` in class `AbstractTrainer`
      Returns:

    - #### isSortAndMerge

          public abstract boolean isSortAndMerge()

    - #### getDataIndexer

          public DataIndexer getDataIndexer(ObjectStream<Event> events)
                                     throws IOException

      Throws:
        `IOException`

    - #### doTrain

          public abstract MaxentModel doTrain(DataIndexer indexer)
                                       throws IOException

      Throws:
        `IOException`

    - #### train

          public final MaxentModel train(DataIndexer indexer)
                                  throws IOException

      Specified by:
        `train` in interface `EventTrainer`
      Throws:
        `IOException`

    - #### train

          public final MaxentModel train(ObjectStream<Event> events)
                                  throws IOException

      Specified by:
        `train` in interface `EventTrainer`
      Throws:
        `IOException`

Copyright © 2026 The Apache Software Foundation. All rights reserved.