AbstractTrainer (Apache OpenNLP Tools 1.9.5 API)
Date: 2026-06-18

opennlp.tools.ml

## Class AbstractTrainer

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

- Direct Known Subclasses:
    AbstractEventModelSequenceTrainer, AbstractEventTrainer, AbstractSequenceTrainer

      public abstract class AbstractTrainer
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `ALGORITHM_PARAM`
    `static int` | `CUTOFF_DEFAULT`
    `static String` | `CUTOFF_PARAM`
    `static int` | `ITERATIONS_DEFAULT`
    `static String` | `ITERATIONS_PARAM`
    `static String` | `TRAINER_TYPE_PARAM`
    `static boolean` | `VERBOSE_DEFAULT`
    `static String` | `VERBOSE_PARAM`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getAlgorithm()`
    `int` | `getCutoff()`
    `int` | `getIterations()`
    `void` | `init(Map<String,String> trainParams, Map<String,String> reportMap)` Deprecated.
    `void` | `init(TrainingParameters trainingParameters, Map<String,String> reportMap)`
    `boolean` | `isValid()` Deprecated. Use `validate()` instead.
    `void` | `validate()` Check parameters.

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

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

- - ### Field Detail

    - #### ALGORITHM_PARAM

          public static final String ALGORITHM_PARAM

      See Also:
        Constant Field Values

    - #### TRAINER_TYPE_PARAM

          public static final String TRAINER_TYPE_PARAM

      See Also:
        Constant Field Values

    - #### CUTOFF_PARAM

          public static final String CUTOFF_PARAM

      See Also:
        Constant Field Values

    - #### CUTOFF_DEFAULT

          public static final int CUTOFF_DEFAULT

      See Also:
        Constant Field Values

    - #### ITERATIONS_PARAM

          public static final String ITERATIONS_PARAM

      See Also:
        Constant Field Values

    - #### ITERATIONS_DEFAULT

          public static final int ITERATIONS_DEFAULT

      See Also:
        Constant Field Values

    - #### VERBOSE_PARAM

          public static final String VERBOSE_PARAM

      See Also:
        Constant Field Values

    - #### VERBOSE_DEFAULT

          public static final boolean VERBOSE_DEFAULT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AbstractTrainer

          public AbstractTrainer()

    - #### AbstractTrainer

          public AbstractTrainer(TrainingParameters parameters)

  - ### Method Detail

    - #### init

          public void init(TrainingParameters trainingParameters,
                           Map<String,String> reportMap)

    - #### init

          @Deprecated
          public void init(Map<String,String> trainParams,
                                       Map<String,String> reportMap)

      Deprecated.

    - #### getAlgorithm

          public String getAlgorithm()

    - #### getCutoff

          public int getCutoff()

    - #### getIterations

          public int getIterations()

    - #### validate

          public void validate()

      Check parameters. If subclass overrides this, it should call super.validate();
      Throws:
        `IllegalArgumentException`

    - #### isValid

          @Deprecated
          public boolean isValid()

      Deprecated. Use `validate()` instead.
      Returns:

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