Package opennlp.tools.util
Class TrainingParameters
- java.lang.Object
-
- opennlp.tools.util.TrainingParameters
-
public class TrainingParameters extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ALGORITHM_PARAM
static java.lang.String
CUTOFF_PARAM
static java.lang.String
ITERATIONS_PARAM
static java.lang.String
THREADS_PARAM
static java.lang.String
TRAINER_TYPE_PARAM
-
Constructor Summary
Constructors Constructor Description TrainingParameters()
TrainingParameters(java.io.InputStream in)
TrainingParameters(java.util.Map<java.lang.String,java.lang.String> map)
Deprecated.TrainingParameters(TrainingParameters trainingParameters)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.String
algorithm()
Retrieves the training algorithm name.java.lang.String
algorithm(java.lang.String namespace)
Retrieves the training algorithm name for a given name space.static TrainingParameters
defaultParams()
boolean
getBooleanParameter(java.lang.String key, boolean defaultValue)
get a Boolean parameterboolean
getBooleanParameter(java.lang.String namespace, java.lang.String key, boolean defaultValue)
get a Boolean parameter in the specified namespacedouble
getDoubleParameter(java.lang.String key, double defaultValue)
get a Double parameterdouble
getDoubleParameter(java.lang.String namespace, java.lang.String key, double defaultValue)
get a Double parameter in the specified namespaceint
getIntParameter(java.lang.String key, int defaultValue)
get an Integer parameterint
getIntParameter(java.lang.String namespace, java.lang.String key, int defaultValue)
get an Integer parameter in the specified namespacejava.util.Map<java.lang.String,java.lang.Object>
getObjectSettings()
Retrieves all parameters without a name space.java.util.Map<java.lang.String,java.lang.Object>
getObjectSettings(java.lang.String namespace)
Retrieves a map with the training parameters which have the passed name space.TrainingParameters
getParameters(java.lang.String namespace)
java.util.Map<java.lang.String,java.lang.String>
getSettings()
Deprecated.usegetObjectSettings()
insteadjava.util.Map<java.lang.String,java.lang.String>
getSettings(java.lang.String namespace)
Deprecated.usegetObjectSettings(String)
insteadjava.lang.String
getStringParameter(java.lang.String key, java.lang.String defaultValue)
get a String parameter.java.lang.String
getStringParameter(java.lang.String namespace, java.lang.String key, java.lang.String defaultValue)
get a String parameter in the specified namespace.void
put(java.lang.String key, boolean value)
void
put(java.lang.String key, double value)
void
put(java.lang.String key, int value)
void
put(java.lang.String key, java.lang.String value)
void
put(java.lang.String namespace, java.lang.String key, boolean value)
void
put(java.lang.String namespace, java.lang.String key, double value)
void
put(java.lang.String namespace, java.lang.String key, int value)
void
put(java.lang.String namespace, java.lang.String key, java.lang.String value)
void
putIfAbsent(java.lang.String key, boolean value)
void
putIfAbsent(java.lang.String key, double value)
void
putIfAbsent(java.lang.String key, int value)
void
putIfAbsent(java.lang.String key, java.lang.String value)
void
putIfAbsent(java.lang.String namespace, java.lang.String key, boolean value)
void
putIfAbsent(java.lang.String namespace, java.lang.String key, double value)
void
putIfAbsent(java.lang.String namespace, java.lang.String key, int value)
void
putIfAbsent(java.lang.String namespace, java.lang.String key, java.lang.String value)
void
serialize(java.io.OutputStream out)
-
-
-
Field Detail
-
ALGORITHM_PARAM
public static final java.lang.String ALGORITHM_PARAM
- See Also:
- Constant Field Values
-
TRAINER_TYPE_PARAM
public static final java.lang.String TRAINER_TYPE_PARAM
- See Also:
- Constant Field Values
-
ITERATIONS_PARAM
public static final java.lang.String ITERATIONS_PARAM
- See Also:
- Constant Field Values
-
CUTOFF_PARAM
public static final java.lang.String CUTOFF_PARAM
- See Also:
- Constant Field Values
-
THREADS_PARAM
public static final java.lang.String THREADS_PARAM
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TrainingParameters
public TrainingParameters()
-
TrainingParameters
public TrainingParameters(TrainingParameters trainingParameters)
-
TrainingParameters
public TrainingParameters(java.util.Map<java.lang.String,java.lang.String> map)
Deprecated.
-
TrainingParameters
public TrainingParameters(java.io.InputStream in) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
algorithm
public java.lang.String algorithm(java.lang.String namespace)
Retrieves the training algorithm name for a given name space.- Returns:
- the name or null if not set.
-
algorithm
public java.lang.String algorithm()
Retrieves the training algorithm name.- Returns:
- the name or null if not set.
-
getSettings
public java.util.Map<java.lang.String,java.lang.String> getSettings(java.lang.String namespace)
Deprecated.usegetObjectSettings(String)
insteadRetrieves a map with the training parameters which have the passed name space.- Parameters:
namespace
-- Returns:
- a parameter map which can be passed to the train and validate methods.
-
getSettings
public java.util.Map<java.lang.String,java.lang.String> getSettings()
Deprecated.usegetObjectSettings()
insteadRetrieves all parameters without a name space.- Returns:
- the settings map
-
getObjectSettings
public java.util.Map<java.lang.String,java.lang.Object> getObjectSettings(java.lang.String namespace)
Retrieves a map with the training parameters which have the passed name space.- Parameters:
namespace
-- Returns:
- a parameter map which can be passed to the train and validate methods.
-
getObjectSettings
public java.util.Map<java.lang.String,java.lang.Object> getObjectSettings()
Retrieves all parameters without a name space.- Returns:
- the settings map
-
getParameters
public TrainingParameters getParameters(java.lang.String namespace)
-
putIfAbsent
public void putIfAbsent(java.lang.String namespace, java.lang.String key, java.lang.String value)
-
putIfAbsent
public void putIfAbsent(java.lang.String key, java.lang.String value)
-
putIfAbsent
public void putIfAbsent(java.lang.String namespace, java.lang.String key, int value)
-
putIfAbsent
public void putIfAbsent(java.lang.String key, int value)
-
putIfAbsent
public void putIfAbsent(java.lang.String namespace, java.lang.String key, double value)
-
putIfAbsent
public void putIfAbsent(java.lang.String key, double value)
-
putIfAbsent
public void putIfAbsent(java.lang.String namespace, java.lang.String key, boolean value)
-
putIfAbsent
public void putIfAbsent(java.lang.String key, boolean value)
-
put
public void put(java.lang.String namespace, java.lang.String key, java.lang.String value)
-
put
public void put(java.lang.String key, java.lang.String value)
-
put
public void put(java.lang.String namespace, java.lang.String key, int value)
-
put
public void put(java.lang.String key, int value)
-
put
public void put(java.lang.String namespace, java.lang.String key, double value)
-
put
public void put(java.lang.String key, double value)
-
put
public void put(java.lang.String namespace, java.lang.String key, boolean value)
-
put
public void put(java.lang.String key, boolean value)
-
serialize
public void serialize(java.io.OutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
getStringParameter
public java.lang.String getStringParameter(java.lang.String key, java.lang.String defaultValue)
get a String parameter.ClassCastException
can be thrown if the value is notString
- Parameters:
key
-defaultValue
-- Returns:
-
getStringParameter
public java.lang.String getStringParameter(java.lang.String namespace, java.lang.String key, java.lang.String defaultValue)
get a String parameter in the specified namespace.ClassCastException
can be thrown if the value is notString
- Parameters:
namespace
-key
-defaultValue
-- Returns:
-
getIntParameter
public int getIntParameter(java.lang.String key, int defaultValue)
get an Integer parameter- Parameters:
key
-defaultValue
-- Returns:
-
getIntParameter
public int getIntParameter(java.lang.String namespace, java.lang.String key, int defaultValue)
get an Integer parameter in the specified namespace- Parameters:
namespace
-key
-defaultValue
-- Returns:
-
getDoubleParameter
public double getDoubleParameter(java.lang.String key, double defaultValue)
get a Double parameter- Parameters:
key
-defaultValue
-- Returns:
-
getDoubleParameter
public double getDoubleParameter(java.lang.String namespace, java.lang.String key, double defaultValue)
get a Double parameter in the specified namespace- Parameters:
namespace
-key
-defaultValue
-- Returns:
-
getBooleanParameter
public boolean getBooleanParameter(java.lang.String key, boolean defaultValue)
get a Boolean parameter- Parameters:
key
-defaultValue
-- Returns:
-
getBooleanParameter
public boolean getBooleanParameter(java.lang.String namespace, java.lang.String key, boolean defaultValue)
get a Boolean parameter in the specified namespace- Parameters:
namespace
-key
-defaultValue
-- Returns:
-
defaultParams
public static TrainingParameters defaultParams()
-
-