Package opennlp.tools.util
Class TrainingParameters
java.lang.Object
opennlp.tools.util.TrainingParameters
Declares and handles default parameters used for or during training models.
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionNo-arg constructor to create a defaultTrainingParametersinstance.InputStreambased constructor that reads inTrainingParameters.TrainingParameters(Map<String, Object> map) Key-value based constructor to apply aMapbased configuration initialization.TrainingParameters(TrainingParameters trainingParameters) Copy constructor to hand over the config of existingTrainingParameters.
- 
Method SummaryModifier and TypeMethodDescriptionstatic TrainingParametersbooleangetBooleanParameter(String key, boolean defaultValue) Obtains a training parameter value.booleangetBooleanParameter(String namespace, String key, boolean defaultValue) Obtains a training parameter value in the specified namespace.doublegetDoubleParameter(String key, double defaultValue) Obtains a training parameter value.doublegetDoubleParameter(String namespace, String key, double defaultValue) Obtains a training parameter value in the specified namespace.intgetIntParameter(String key, int defaultValue) Obtains a training parameter value.intgetIntParameter(String namespace, String key, int defaultValue) Obtains a training parameter value in the specified namespace.getObjectSettings(String namespace) getParameters(String namespace) getStringParameter(String key, String defaultValue) Obtains a training parameter value.getStringParameter(String namespace, String key, String defaultValue) Obtains a training parameter value in the specified namespace.voidvoidvoidvoidvoidvoidvoidvoidvoidputIfAbsent(String key, boolean value) Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before.voidputIfAbsent(String key, double value) Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before.voidputIfAbsent(String key, int value) Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before.voidputIfAbsent(String key, String value) Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before.voidputIfAbsent(String namespace, String key, boolean value) Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before.voidputIfAbsent(String namespace, String key, double value) Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before.voidputIfAbsent(String namespace, String key, int value) Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before.voidputIfAbsent(String namespace, String key, String value) Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before.voidserialize(OutputStream out) Serializes aTrainingParametersinstance via a specifiedOutputStream.static TrainingParameters
- 
Field Details- 
ALGORITHM_PARAM- See Also:
 
- 
TRAINER_TYPE_PARAM- See Also:
 
- 
ITERATIONS_PARAM- See Also:
 
- 
CUTOFF_PARAM- See Also:
 
- 
THREADS_PARAM- See Also:
 
- 
ITERATIONS_DEFAULT_VALUEpublic static final int ITERATIONS_DEFAULT_VALUEThe default number of iterations is 100.- See Also:
 
- 
CUTOFF_DEFAULT_VALUEpublic static final int CUTOFF_DEFAULT_VALUEThe default cut off value is 5.- See Also:
 
 
- 
- 
Constructor Details- 
TrainingParameterspublic TrainingParameters()No-arg constructor to create a defaultTrainingParametersinstance.
- 
TrainingParametersCopy constructor to hand over the config of existingTrainingParameters.
- 
TrainingParametersKey-value based constructor to apply aMapbased configuration initialization.
- 
TrainingParametersInputStreambased constructor that reads inTrainingParameters.- Throws:
- IOException- Thrown if IO errors occurred.
 
 
- 
- 
Method Details- 
algorithm- Returns:
- Retrieves the training algorithm name for a given name space, or nullif unset.
 
- 
algorithm- Returns:
- Retrieves the training algorithm name. or @code null} if not set.
 
- 
getObjectSettings- Parameters:
- namespace- The name space to filter or narrow the search space. May be- null.
- Returns:
- Retrieves a parameter Mapwhich can be passed to the train and validate methods.
 
- 
getObjectSettings- Returns:
- Retrieves a parameter Mapof all parameters without narrowing.
 
- 
getParameters- Parameters:
- namespace- The name space to filter or narrow the search space. May be- null.
- Returns:
- Retrieves TrainingParameterswhich can be passed to the train and validate methods.
 
- 
putIfAbsentPuts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before. Thenamespacecan be used to prefix thekey.- Parameters:
- namespace- A prefix to declare or use a name space under which- keyshall be put. May be- null.
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Stringparameter to put into this- TrainingParametersinstance.
 
- 
putIfAbsentPuts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before.- Parameters:
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Stringparameter to put into this- TrainingParametersinstance.
 
- 
putIfAbsentPuts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before. Thenamespacecan be used to prefix thekey.- Parameters:
- namespace- A prefix to declare or use a name space under which- keyshall be put. May be- null.
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Integerparameter to put into this- TrainingParametersinstance.
 
- 
putIfAbsentPuts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before.- Parameters:
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Integerparameter to put into this- TrainingParametersinstance.
 
- 
putIfAbsentPuts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before. Thenamespacecan be used to prefix thekey.- Parameters:
- namespace- A prefix to declare or use a name space under which- keyshall be put. May be- null.
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Doubleparameter to put into this- TrainingParametersinstance.
 
- 
putIfAbsentPuts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before. Thenamespacecan be used to prefix thekey.- Parameters:
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Doubleparameter to put into this- TrainingParametersinstance.
 
- 
putIfAbsentPuts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before. Thenamespacecan be used to prefix thekey.- Parameters:
- namespace- A prefix to declare or use a name space under which- keyshall be put. May be- null.
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Booleanparameter to put into this- TrainingParametersinstance.
 
- 
putIfAbsentPuts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before.- Parameters:
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Booleanparameter to put into this- TrainingParametersinstance.
 
- 
putPuts avalueinto the currentTrainingParametersunder a certainkey. If the value was present before, the previous value will be overwritten with the specified one. Thenamespacecan be used to prefix thekey.- Parameters:
- namespace- A prefix to declare or use a name space under which- keyshall be put. May be- null.
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Stringparameter to put into this- TrainingParametersinstance.
 
- 
putPuts avalueinto the currentTrainingParametersunder a certainkey. If the value was present before, the previous value will be overwritten with the specified one.- Parameters:
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Stringparameter to put into this- TrainingParametersinstance.
 
- 
putPuts avalueinto the currentTrainingParametersunder a certainkey. If the value was present before, the previous value will be overwritten with the specified one. Thenamespacecan be used to prefix thekey.- Parameters:
- namespace- A prefix to declare or use a name space under which- keyshall be put. May be- null.
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Integerparameter to put into this- TrainingParametersinstance.
 
- 
putPuts avalueinto the currentTrainingParametersunder a certainkey. If the value was present before, the previous value will be overwritten with the specified one.- Parameters:
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Integerparameter to put into this- TrainingParametersinstance.
 
- 
putPuts avalueinto the currentTrainingParametersunder a certainkey. If the value was present before, the previous value will be overwritten with the specified one. Thenamespacecan be used to prefix thekey.- Parameters:
- namespace- A prefix to declare or use a name space under which- keyshall be put. May be- null.
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Doubleparameter to put into this- TrainingParametersinstance.
 
- 
putPuts avalueinto the currentTrainingParametersunder a certainkey. If the value was present before, the previous value will be overwritten with the specified one.- Parameters:
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Doubleparameter to put into this- TrainingParametersinstance.
 
- 
putPuts avalueinto the currentTrainingParametersunder a certainkey. If the value was present before, the previous value will be overwritten with the specified one. Thenamespacecan be used to prefix thekey.- Parameters:
- namespace- A prefix to declare or use a name space under which- keyshall be put. May be- null.
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Booleanparameter to put into this- TrainingParametersinstance.
 
- 
putPuts avalueinto the currentTrainingParametersunder a certainkey. If the value was present before, the previous value will be overwritten with the specified one.- Parameters:
- key- The identifying key to put or retrieve a- valuewith.
- value- The- Booleanparameter to put into this- TrainingParametersinstance.
 
- 
serializeSerializes aTrainingParametersinstance via a specifiedOutputStream.- Parameters:
- out- A valid, open- OutputStreamto write to.
- Throws:
- IOException- Thrown if errors occurred.
 
- 
getStringParameterObtains a training parameter value.Note: ClassCastExceptioncan be thrown if the value is notString- Parameters:
- key- The identifying key to retrieve a- valuewith.
- defaultValue- The alternative value to use, if- keywas not present.
- Returns:
- The training valueassociated withkeyif present, or adefaultValueif not.
 
- 
getStringParameterObtains a training parameter value in the specified namespace.Note: ClassCastExceptioncan be thrown if the value is notString- Parameters:
- namespace- A prefix to declare or use a name space under which- keyshall be searched. May be- null.
- key- The identifying key to retrieve a- valuewith.
- defaultValue- The alternative value to use, if- keywas not present.
- Returns:
- The training valueassociated withkeyif present, or adefaultValueif not.
 
- 
getIntParameterObtains a training parameter value.- Parameters:
- key- The identifying key to retrieve a- valuewith.
- defaultValue- The alternative value to use, if- keywas not present.
- Returns:
- The training valueassociated withkeyif present, or adefaultValueif not.
 
- 
getIntParameterObtains a training parameter value in the specified namespace.- Parameters:
- namespace- A prefix to declare or use a name space under which- keyshall be searched. May be- null.
- key- The identifying key to retrieve a- valuewith.
- defaultValue- The alternative value to use, if- keywas not present.
- Returns:
- The training valueassociated withkeyif present, or adefaultValueif not.
 
- 
getDoubleParameterObtains a training parameter value.- Parameters:
- key- The identifying key to retrieve a- valuewith.
- defaultValue- The alternative value to use, if- keywas not present.
- Returns:
- The training valueassociated withkeyif present, or adefaultValueif not.
 
- 
getDoubleParameterObtains a training parameter value in the specified namespace.- Parameters:
- namespace- A prefix to declare or use a name space under which- keyshall be searched. May be- null.
- key- The identifying key to retrieve a- valuewith.
- defaultValue- The alternative value to use, if- keywas not present.
- Returns:
- The training valueassociated withkeyif present, or adefaultValueif not.
 
- 
getBooleanParameterObtains a training parameter value.- Parameters:
- key- The identifying key to retrieve a- valuewith.
- defaultValue- The alternative value to use, if- keywas not present.
- Returns:
- The training valueassociated withkeyif present, or adefaultValueif not.
 
- 
getBooleanParameterObtains a training parameter value in the specified namespace.- Parameters:
- namespace- A prefix to declare or use a name space under which- keyshall be searched. May be- null.
- key- The identifying key to retrieve a- valuewith.
- defaultValue- The alternative value to use, if- keywas not present.
- Returns:
- The training valueassociated withkeyif present, or adefaultValueif not.
 
- 
defaultParams- Returns:
- Retrieves a new instanceinitialized with default values.
 
- 
setParams
 
-