Package opennlp.tools.util
Klasse TrainingParameters
java.lang.Object
opennlp.tools.util.TrainingParameters
Declares and handles default parameters used for or during training models.
-
Feldübersicht
Felder -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungNo-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. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic 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
-
Felddetails
-
ALGORITHM_PARAM
- Siehe auch:
-
TRAINER_TYPE_PARAM
- Siehe auch:
-
ITERATIONS_PARAM
- Siehe auch:
-
CUTOFF_PARAM
- Siehe auch:
-
THREADS_PARAM
- Siehe auch:
-
ITERATIONS_DEFAULT_VALUE
public static final int ITERATIONS_DEFAULT_VALUEThe default number of iterations is 100.- Siehe auch:
-
CUTOFF_DEFAULT_VALUE
public static final int CUTOFF_DEFAULT_VALUEThe default cut off value is 5.- Siehe auch:
-
-
Konstruktordetails
-
TrainingParameters
public TrainingParameters()No-arg constructor to create a defaultTrainingParametersinstance. -
TrainingParameters
Copy constructor to hand over the config of existingTrainingParameters. -
TrainingParameters
Key-value based constructor to apply aMapbased configuration initialization. -
TrainingParameters
InputStreambased constructor that reads inTrainingParameters.- Löst aus:
IOException- Thrown if IO errors occurred.
-
-
Methodendetails
-
algorithm
- Gibt zurück:
- Retrieves the training algorithm name for a given name space, or
nullif unset.
-
algorithm
- Gibt zurück:
- Retrieves the training algorithm name. or @code null} if not set.
-
getObjectSettings
- Parameter:
namespace- The name space to filter or narrow the search space. May benull.- Gibt zurück:
- Retrieves a parameter
Mapwhich can be passed to the train and validate methods.
-
getObjectSettings
- Gibt zurück:
- Retrieves a parameter
Mapof all parameters without narrowing.
-
getParameters
- Parameter:
namespace- The name space to filter or narrow the search space. May benull.- Gibt zurück:
- Retrieves
TrainingParameterswhich can be passed to the train and validate methods.
-
putIfAbsent
Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before. Thenamespacecan be used to prefix thekey.- Parameter:
namespace- A prefix to declare or use a name space under whichkeyshall be put. May benull.key- The identifying key to put or retrieve avaluewith.value- TheStringparameter to put into thisTrainingParametersinstance.
-
putIfAbsent
Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before.- Parameter:
key- The identifying key to put or retrieve avaluewith.value- TheStringparameter to put into thisTrainingParametersinstance.
-
putIfAbsent
Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before. Thenamespacecan be used to prefix thekey.- Parameter:
namespace- A prefix to declare or use a name space under whichkeyshall be put. May benull.key- The identifying key to put or retrieve avaluewith.value- TheIntegerparameter to put into thisTrainingParametersinstance.
-
putIfAbsent
Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before.- Parameter:
key- The identifying key to put or retrieve avaluewith.value- TheIntegerparameter to put into thisTrainingParametersinstance.
-
putIfAbsent
Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before. Thenamespacecan be used to prefix thekey.- Parameter:
namespace- A prefix to declare or use a name space under whichkeyshall be put. May benull.key- The identifying key to put or retrieve avaluewith.value- TheDoubleparameter to put into thisTrainingParametersinstance.
-
putIfAbsent
Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before. Thenamespacecan be used to prefix thekey.- Parameter:
key- The identifying key to put or retrieve avaluewith.value- TheDoubleparameter to put into thisTrainingParametersinstance.
-
putIfAbsent
Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before. Thenamespacecan be used to prefix thekey.- Parameter:
namespace- A prefix to declare or use a name space under whichkeyshall be put. May benull.key- The identifying key to put or retrieve avaluewith.value- TheBooleanparameter to put into thisTrainingParametersinstance.
-
putIfAbsent
Puts avalueinto the currentTrainingParametersunder a certainkey, if the value was not present before.- Parameter:
key- The identifying key to put or retrieve avaluewith.value- TheBooleanparameter to put into thisTrainingParametersinstance.
-
put
Puts 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.- Parameter:
namespace- A prefix to declare or use a name space under whichkeyshall be put. May benull.key- The identifying key to put or retrieve avaluewith.value- TheStringparameter to put into thisTrainingParametersinstance.
-
put
Puts avalueinto the currentTrainingParametersunder a certainkey. If the value was present before, the previous value will be overwritten with the specified one.- Parameter:
key- The identifying key to put or retrieve avaluewith.value- TheStringparameter to put into thisTrainingParametersinstance.
-
put
Puts 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.- Parameter:
namespace- A prefix to declare or use a name space under whichkeyshall be put. May benull.key- The identifying key to put or retrieve avaluewith.value- TheIntegerparameter to put into thisTrainingParametersinstance.
-
put
Puts avalueinto the currentTrainingParametersunder a certainkey. If the value was present before, the previous value will be overwritten with the specified one.- Parameter:
key- The identifying key to put or retrieve avaluewith.value- TheIntegerparameter to put into thisTrainingParametersinstance.
-
put
Puts 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.- Parameter:
namespace- A prefix to declare or use a name space under whichkeyshall be put. May benull.key- The identifying key to put or retrieve avaluewith.value- TheDoubleparameter to put into thisTrainingParametersinstance.
-
put
Puts avalueinto the currentTrainingParametersunder a certainkey. If the value was present before, the previous value will be overwritten with the specified one.- Parameter:
key- The identifying key to put or retrieve avaluewith.value- TheDoubleparameter to put into thisTrainingParametersinstance.
-
put
Puts 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.- Parameter:
namespace- A prefix to declare or use a name space under whichkeyshall be put. May benull.key- The identifying key to put or retrieve avaluewith.value- TheBooleanparameter to put into thisTrainingParametersinstance.
-
put
Puts avalueinto the currentTrainingParametersunder a certainkey. If the value was present before, the previous value will be overwritten with the specified one.- Parameter:
key- The identifying key to put or retrieve avaluewith.value- TheBooleanparameter to put into thisTrainingParametersinstance.
-
serialize
Serializes aTrainingParametersinstance via a specifiedOutputStream.- Parameter:
out- A valid, openOutputStreamto write to.- Löst aus:
IOException- Thrown if errors occurred.
-
getStringParameter
Obtains a training parameter value.Note:
ClassCastExceptioncan be thrown if the value is notString- Parameter:
key- The identifying key to retrieve avaluewith.defaultValue- The alternative value to use, ifkeywas not present.- Gibt zurück:
- The
training valueassociated withkeyif present, or adefaultValueif not.
-
getStringParameter
Obtains a training parameter value in the specified namespace.Note:
ClassCastExceptioncan be thrown if the value is notString- Parameter:
namespace- A prefix to declare or use a name space under whichkeyshall be searched. May benull.key- The identifying key to retrieve avaluewith.defaultValue- The alternative value to use, ifkeywas not present.- Gibt zurück:
- The
training valueassociated withkeyif present, or adefaultValueif not.
-
getIntParameter
Obtains a training parameter value.- Parameter:
key- The identifying key to retrieve avaluewith.defaultValue- The alternative value to use, ifkeywas not present.- Gibt zurück:
- The
training valueassociated withkeyif present, or adefaultValueif not.
-
getIntParameter
Obtains a training parameter value in the specified namespace.- Parameter:
namespace- A prefix to declare or use a name space under whichkeyshall be searched. May benull.key- The identifying key to retrieve avaluewith.defaultValue- The alternative value to use, ifkeywas not present.- Gibt zurück:
- The
training valueassociated withkeyif present, or adefaultValueif not.
-
getDoubleParameter
Obtains a training parameter value.- Parameter:
key- The identifying key to retrieve avaluewith.defaultValue- The alternative value to use, ifkeywas not present.- Gibt zurück:
- The
training valueassociated withkeyif present, or adefaultValueif not.
-
getDoubleParameter
Obtains a training parameter value in the specified namespace.- Parameter:
namespace- A prefix to declare or use a name space under whichkeyshall be searched. May benull.key- The identifying key to retrieve avaluewith.defaultValue- The alternative value to use, ifkeywas not present.- Gibt zurück:
- The
training valueassociated withkeyif present, or adefaultValueif not.
-
getBooleanParameter
Obtains a training parameter value.- Parameter:
key- The identifying key to retrieve avaluewith.defaultValue- The alternative value to use, ifkeywas not present.- Gibt zurück:
- The
training valueassociated withkeyif present, or adefaultValueif not.
-
getBooleanParameter
Obtains a training parameter value in the specified namespace.- Parameter:
namespace- A prefix to declare or use a name space under whichkeyshall be searched. May benull.key- The identifying key to retrieve avaluewith.defaultValue- The alternative value to use, ifkeywas not present.- Gibt zurück:
- The
training valueassociated withkeyif present, or adefaultValueif not.
-
defaultParams
- Gibt zurück:
- Retrieves a new
instanceinitialized with default values.
-
setParams
-