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
-
Konstruktorübersicht
KonstruktorBeschreibungNo-arg constructor to create a defaultTrainingParameters
instance.InputStream
based constructor that reads inTrainingParameters
.TrainingParameters
(Map<String, Object> map) Key-value based constructor to apply aMap
based configuration initialization.TrainingParameters
(TrainingParameters trainingParameters) Copy constructor to hand over the config of existingTrainingParameters
. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic TrainingParameters
boolean
getBooleanParameter
(String key, boolean defaultValue) Obtains a training parameter value.boolean
getBooleanParameter
(String namespace, String key, boolean defaultValue) Obtains a training parameter value in the specified namespace.double
getDoubleParameter
(String key, double defaultValue) Obtains a training parameter value.double
getDoubleParameter
(String namespace, String key, double defaultValue) Obtains a training parameter value in the specified namespace.int
getIntParameter
(String key, int defaultValue) Obtains a training parameter value.int
getIntParameter
(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.void
void
void
void
void
void
void
void
void
putIfAbsent
(String key, boolean value) Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before.void
putIfAbsent
(String key, double value) Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before.void
putIfAbsent
(String key, int value) Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before.void
putIfAbsent
(String key, String value) Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before.void
putIfAbsent
(String namespace, String key, boolean value) Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before.void
putIfAbsent
(String namespace, String key, double value) Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before.void
putIfAbsent
(String namespace, String key, int value) Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before.void
putIfAbsent
(String namespace, String key, String value) Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before.void
serialize
(OutputStream out) Serializes aTrainingParameters
instance 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 defaultTrainingParameters
instance. -
TrainingParameters
Copy constructor to hand over the config of existingTrainingParameters
. -
TrainingParameters
Key-value based constructor to apply aMap
based configuration initialization. -
TrainingParameters
InputStream
based 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
null
if 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
Map
which can be passed to the train and validate methods.
-
getObjectSettings
- Gibt zurück:
- Retrieves a parameter
Map
of all parameters without narrowing.
-
getParameters
- Parameter:
namespace
- The name space to filter or narrow the search space. May benull
.- Gibt zurück:
- Retrieves
TrainingParameters
which can be passed to the train and validate methods.
-
putIfAbsent
Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before. Thenamespace
can be used to prefix thekey
.- Parameter:
namespace
- A prefix to declare or use a name space under whichkey
shall be put. May benull
.key
- The identifying key to put or retrieve avalue
with.value
- TheString
parameter to put into thisTrainingParameters
instance.
-
putIfAbsent
Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before.- Parameter:
key
- The identifying key to put or retrieve avalue
with.value
- TheString
parameter to put into thisTrainingParameters
instance.
-
putIfAbsent
Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before. Thenamespace
can be used to prefix thekey
.- Parameter:
namespace
- A prefix to declare or use a name space under whichkey
shall be put. May benull
.key
- The identifying key to put or retrieve avalue
with.value
- TheInteger
parameter to put into thisTrainingParameters
instance.
-
putIfAbsent
Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before.- Parameter:
key
- The identifying key to put or retrieve avalue
with.value
- TheInteger
parameter to put into thisTrainingParameters
instance.
-
putIfAbsent
Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before. Thenamespace
can be used to prefix thekey
.- Parameter:
namespace
- A prefix to declare or use a name space under whichkey
shall be put. May benull
.key
- The identifying key to put or retrieve avalue
with.value
- TheDouble
parameter to put into thisTrainingParameters
instance.
-
putIfAbsent
Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before. Thenamespace
can be used to prefix thekey
.- Parameter:
key
- The identifying key to put or retrieve avalue
with.value
- TheDouble
parameter to put into thisTrainingParameters
instance.
-
putIfAbsent
Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before. Thenamespace
can be used to prefix thekey
.- Parameter:
namespace
- A prefix to declare or use a name space under whichkey
shall be put. May benull
.key
- The identifying key to put or retrieve avalue
with.value
- TheBoolean
parameter to put into thisTrainingParameters
instance.
-
putIfAbsent
Puts avalue
into the currentTrainingParameters
under a certainkey
, if the value was not present before.- Parameter:
key
- The identifying key to put or retrieve avalue
with.value
- TheBoolean
parameter to put into thisTrainingParameters
instance.
-
put
Puts avalue
into the currentTrainingParameters
under a certainkey
. If the value was present before, the previous value will be overwritten with the specified one. Thenamespace
can be used to prefix thekey
.- Parameter:
namespace
- A prefix to declare or use a name space under whichkey
shall be put. May benull
.key
- The identifying key to put or retrieve avalue
with.value
- TheString
parameter to put into thisTrainingParameters
instance.
-
put
Puts avalue
into the currentTrainingParameters
under 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 avalue
with.value
- TheString
parameter to put into thisTrainingParameters
instance.
-
put
Puts avalue
into the currentTrainingParameters
under a certainkey
. If the value was present before, the previous value will be overwritten with the specified one. Thenamespace
can be used to prefix thekey
.- Parameter:
namespace
- A prefix to declare or use a name space under whichkey
shall be put. May benull
.key
- The identifying key to put or retrieve avalue
with.value
- TheInteger
parameter to put into thisTrainingParameters
instance.
-
put
Puts avalue
into the currentTrainingParameters
under 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 avalue
with.value
- TheInteger
parameter to put into thisTrainingParameters
instance.
-
put
Puts avalue
into the currentTrainingParameters
under a certainkey
. If the value was present before, the previous value will be overwritten with the specified one. Thenamespace
can be used to prefix thekey
.- Parameter:
namespace
- A prefix to declare or use a name space under whichkey
shall be put. May benull
.key
- The identifying key to put or retrieve avalue
with.value
- TheDouble
parameter to put into thisTrainingParameters
instance.
-
put
Puts avalue
into the currentTrainingParameters
under 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 avalue
with.value
- TheDouble
parameter to put into thisTrainingParameters
instance.
-
put
Puts avalue
into the currentTrainingParameters
under a certainkey
. If the value was present before, the previous value will be overwritten with the specified one. Thenamespace
can be used to prefix thekey
.- Parameter:
namespace
- A prefix to declare or use a name space under whichkey
shall be put. May benull
.key
- The identifying key to put or retrieve avalue
with.value
- TheBoolean
parameter to put into thisTrainingParameters
instance.
-
put
Puts avalue
into the currentTrainingParameters
under 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 avalue
with.value
- TheBoolean
parameter to put into thisTrainingParameters
instance.
-
serialize
Serializes aTrainingParameters
instance via a specifiedOutputStream
.- Parameter:
out
- A valid, openOutputStream
to write to.- Löst aus:
IOException
- Thrown if errors occurred.
-
getStringParameter
Obtains a training parameter value.Note:
ClassCastException
can be thrown if the value is notString
- Parameter:
key
- The identifying key to retrieve avalue
with.defaultValue
- The alternative value to use, ifkey
was not present.- Gibt zurück:
- The
training value
associated withkey
if present, or adefaultValue
if not.
-
getStringParameter
Obtains a training parameter value in the specified namespace.Note:
ClassCastException
can be thrown if the value is notString
- Parameter:
namespace
- A prefix to declare or use a name space under whichkey
shall be searched. May benull
.key
- The identifying key to retrieve avalue
with.defaultValue
- The alternative value to use, ifkey
was not present.- Gibt zurück:
- The
training value
associated withkey
if present, or adefaultValue
if not.
-
getIntParameter
Obtains a training parameter value.- Parameter:
key
- The identifying key to retrieve avalue
with.defaultValue
- The alternative value to use, ifkey
was not present.- Gibt zurück:
- The
training value
associated withkey
if present, or adefaultValue
if not.
-
getIntParameter
Obtains a training parameter value in the specified namespace.- Parameter:
namespace
- A prefix to declare or use a name space under whichkey
shall be searched. May benull
.key
- The identifying key to retrieve avalue
with.defaultValue
- The alternative value to use, ifkey
was not present.- Gibt zurück:
- The
training value
associated withkey
if present, or adefaultValue
if not.
-
getDoubleParameter
Obtains a training parameter value.- Parameter:
key
- The identifying key to retrieve avalue
with.defaultValue
- The alternative value to use, ifkey
was not present.- Gibt zurück:
- The
training value
associated withkey
if present, or adefaultValue
if not.
-
getDoubleParameter
Obtains a training parameter value in the specified namespace.- Parameter:
namespace
- A prefix to declare or use a name space under whichkey
shall be searched. May benull
.key
- The identifying key to retrieve avalue
with.defaultValue
- The alternative value to use, ifkey
was not present.- Gibt zurück:
- The
training value
associated withkey
if present, or adefaultValue
if not.
-
getBooleanParameter
Obtains a training parameter value.- Parameter:
key
- The identifying key to retrieve avalue
with.defaultValue
- The alternative value to use, ifkey
was not present.- Gibt zurück:
- The
training value
associated withkey
if present, or adefaultValue
if not.
-
getBooleanParameter
Obtains a training parameter value in the specified namespace.- Parameter:
namespace
- A prefix to declare or use a name space under whichkey
shall be searched. May benull
.key
- The identifying key to retrieve avalue
with.defaultValue
- The alternative value to use, ifkey
was not present.- Gibt zurück:
- The
training value
associated withkey
if present, or adefaultValue
if not.
-
defaultParams
- Gibt zurück:
- Retrieves a new
instance
initialized with default values.
-
setParams
-