Package opennlp.tools.ml
Class TrainerFactory
java.lang.Object
opennlp.tools.ml.TrainerFactory
A factory to initialize 
Trainer instances depending on a trainer type
 configured via TrainingParameters.- 
Nested Class SummaryNested Classes
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> EventModelSequenceTrainer<T> getEventModelSequenceTrainer(TrainingParameters trainParams, Map<String, String> reportMap) Retrieves anEventModelSequenceTrainerthat fits the given parameters.static EventTrainergetEventTrainer(TrainingParameters trainParams, Map<String, String> reportMap) Retrieves anEventTrainerthat fits the given parameters.static SequenceTrainergetSequenceModelTrainer(TrainingParameters trainParams, Map<String, String> reportMap) Retrieves aSequenceTrainerthat fits the given parameters.static TrainerFactory.TrainerTypegetTrainerType(TrainingParameters trainParams) Determines theTrainerFactory.TrainerTypebased on theTrainingParameters.ALGORITHM_PARAMvalue.static booleanisValid(TrainingParameters trainParams) 
- 
Constructor Details- 
TrainerFactorypublic TrainerFactory()
 
- 
- 
Method Details- 
getTrainerTypeDetermines theTrainerFactory.TrainerTypebased on theTrainingParameters.ALGORITHM_PARAMvalue.- Parameters:
- trainParams- - A mapping of- training parameters.
- Returns:
- The TrainerFactory.TrainerTypeornullif the type couldn't be determined.
 
- 
getSequenceModelTrainerpublic static SequenceTrainer getSequenceModelTrainer(TrainingParameters trainParams, Map<String, String> reportMap) Retrieves aSequenceTrainerthat fits the given parameters.- Parameters:
- trainParams- The- TrainingParametersto check for the trainer type. Note: The entry- TrainingParameters.ALGORITHM_PARAMis used to determine the type.
- reportMap- A- Mapthat shall be used during initialization of the- SequenceTrainer.
- Returns:
- A valid SequenceTrainerfor the configuredtrainParams.
- Throws:
- IllegalArgumentException- Thrown if the trainer type could not be determined.
 
- 
getEventModelSequenceTrainerpublic static <T> EventModelSequenceTrainer<T> getEventModelSequenceTrainer(TrainingParameters trainParams, Map<String, String> reportMap) Retrieves anEventModelSequenceTrainerthat fits the given parameters.- Parameters:
- trainParams- The- TrainingParametersto check for the trainer type. Note: The entry- TrainingParameters.ALGORITHM_PARAMis used to determine the type.
- reportMap- A- Mapthat shall be used during initialization of the- EventModelSequenceTrainer.
- Returns:
- A valid EventModelSequenceTrainerfor the configuredtrainParams.
- Throws:
- IllegalArgumentException- Thrown if the trainer type could not be determined.
 
- 
getEventTrainerpublic static EventTrainer getEventTrainer(TrainingParameters trainParams, Map<String, String> reportMap) Retrieves anEventTrainerthat fits the given parameters.- Parameters:
- trainParams- The- TrainingParametersto check for the trainer type. Note: The entry- TrainingParameters.ALGORITHM_PARAMis used to determine the type. If the type is not defined, the- GISTrainer.MAXENT_VALUEwill be used.
- reportMap- A- Mapthat shall be used during initialization of the- EventTrainer.
- Returns:
- A valid EventTrainerfor the configuredtrainParams.
 
- 
isValid- Parameters:
- trainParams- The- TrainingParametersto validate. Must not be- null.
- Returns:
- trueif the- trainParamscould be validated,- falseotherwise.
 
 
-