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

opennlp.tools.ml

## Class TrainerFactory

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

-     public class TrainerFactory
      extends Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TrainerFactory.TrainerType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TrainerFactory()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static EventModelSequenceTrainer` | `getEventModelSequenceTrainer(TrainingParameters trainParams, Map<String,String> reportMap)`
    `static EventTrainer` | `getEventTrainer(TrainingParameters trainParams, Map<String,String> reportMap)`
    `static SequenceTrainer` | `getSequenceModelTrainer(TrainingParameters trainParams, Map<String,String> reportMap)`
    `static TrainerFactory.TrainerType` | `getTrainerType(TrainingParameters trainParams)` Determines the trainer type based on the ALGORITHM_PARAM value.
    `static boolean` | `isValid(TrainingParameters trainParams)`

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

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

- - ### Constructor Detail

    - #### TrainerFactory

          public TrainerFactory()

  - ### Method Detail

    - #### getTrainerType

          public static TrainerFactory.TrainerType getTrainerType(TrainingParameters trainParams)

      Determines the trainer type based on the ALGORITHM_PARAM value.
      Parameters:
        `trainParams` - - Map of training parameters
      Returns:
        the trainer type or null if type couldn't be determined.

    - #### getSequenceModelTrainer

          public static SequenceTrainer getSequenceModelTrainer(TrainingParameters trainParams,
                                                                Map<String,String> reportMap)

    - #### getEventModelSequenceTrainer

          public static EventModelSequenceTrainer getEventModelSequenceTrainer(TrainingParameters trainParams,
                                                                               Map<String,String> reportMap)

    - #### getEventTrainer

          public static EventTrainer getEventTrainer(TrainingParameters trainParams,
                                                     Map<String,String> reportMap)

    - #### isValid

          public static boolean isValid(TrainingParameters trainParams)

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