Package opennlp.tools.ml

## Class AbstractEventTrainer

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

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

      public abstract class AbstractEventTrainer
      extends AbstractTrainer
      implements EventTrainer

  A basic `EventTrainer` implementation.

- - ### Field Summary

    Fields
    Modifier and Type | Field | 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`

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

      `EVENT_VALUE`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AbstractEventTrainer()` |
    `AbstractEventTrainer​(TrainingParameters parameters)` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract MaxentModel` | `doTrain​(DataIndexer indexer)` |
    `DataIndexer` | `getDataIndexer​(ObjectStream<Event> events)` |
    `abstract boolean` | `isSortAndMerge()` |
    `boolean` | `isValid()` | Deprecated. Use `validate()` instead.
    `MaxentModel` | `train​(DataIndexer indexer)` | Trains a `MaxentModel` for given `events`.
    `MaxentModel` | `train​(ObjectStream<Event> events)` | Trains a `MaxentModel` for given `events`.
    `void` | `validate()` | Checks the configured `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.commons.Trainer

      `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`
      Checks the configured `parameters`. If a subclass overrides this, it should call `super.validate();`.
      Overrides:
        `validate` in class `AbstractTrainer`

    - #### isValid

          @Deprecated
          public boolean isValid()

      Deprecated.
      Use `validate()` instead.
      Overrides:
        `isValid` in class `AbstractTrainer`
      Returns:
        `true` if the validation of the internal configuration succeeds, `false` otherwise.

    - #### 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

      Description copied from interface: `EventTrainer`
      Trains a `MaxentModel` for given `events`.
      Specified by:
        `train` in interface `EventTrainer`
      Parameters:
        `indexer` - The input `indexer` to use.
      Returns:
        The trained `MaxentModel`.
      Throws:
        `IOException` - Thrown if IO errors occurred.

    - #### train

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

      Description copied from interface: `EventTrainer`
      Trains a `MaxentModel` for given `events`.
      Specified by:
        `train` in interface `EventTrainer`
      Parameters:
        `events` - The input `events`.
      Returns:
        The trained `MaxentModel`.
      Throws:
        `IOException` - Thrown if IO errors occurred.