Package opennlp.tools.util

## Class TrainingParameters

- java.lang.Object
- - opennlp.tools.util.TrainingParameters

-     public class TrainingParameters
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `ALGORITHM_PARAM` |
    `static String` | `CUTOFF_PARAM` |
    `static String` | `ITERATIONS_PARAM` |
    `static String` | `THREADS_PARAM` |
    `static String` | `TRAINER_TYPE_PARAM` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TrainingParameters()` |
    `TrainingParameters​(InputStream in)` |
    `TrainingParameters​(Map<String,​String> map)` | Deprecated.
    `TrainingParameters​(TrainingParameters trainingParameters)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `String` | `algorithm()` | Retrieves the training algorithm name.
    `String` | `algorithm​(String namespace)` | Retrieves the training algorithm name for a given name space.
    `static TrainingParameters` | `defaultParams()` |
    `boolean` | `getBooleanParameter​(String key, boolean defaultValue)` | get a Boolean parameter
    `boolean` | `getBooleanParameter​(String namespace, String key, boolean defaultValue)` | get a Boolean parameter in the specified namespace
    `double` | `getDoubleParameter​(String key, double defaultValue)` | get a Double parameter
    `double` | `getDoubleParameter​(String namespace, String key, double defaultValue)` | get a Double parameter in the specified namespace
    `int` | `getIntParameter​(String key, int defaultValue)` | get an Integer parameter
    `int` | `getIntParameter​(String namespace, String key, int defaultValue)` | get an Integer parameter in the specified namespace
    `Map<String,​Object>` | `getObjectSettings()` | Retrieves all parameters without a name space.
    `Map<String,​Object>` | `getObjectSettings​(String namespace)` | Retrieves a map with the training parameters which have the passed name space.
    `TrainingParameters` | `getParameters​(String namespace)` |
    `Map<String,​String>` | `getSettings()` | Deprecated. use `getObjectSettings()` instead
    `Map<String,​String>` | `getSettings​(String namespace)` | Deprecated. use `getObjectSettings(String)` instead
    `String` | `getStringParameter​(String key, String defaultValue)` | get a String parameter.
    `String` | `getStringParameter​(String namespace, String key, String defaultValue)` | get a String parameter in the specified namespace.
    `void` | `put​(String key, boolean value)` |
    `void` | `put​(String key, double value)` |
    `void` | `put​(String key, int value)` |
    `void` | `put​(String key, String value)` |
    `void` | `put​(String namespace, String key, boolean value)` |
    `void` | `put​(String namespace, String key, double value)` |
    `void` | `put​(String namespace, String key, int value)` |
    `void` | `put​(String namespace, String key, String value)` |
    `void` | `putIfAbsent​(String key, boolean value)` |
    `void` | `putIfAbsent​(String key, double value)` |
    `void` | `putIfAbsent​(String key, int value)` |
    `void` | `putIfAbsent​(String key, String value)` |
    `void` | `putIfAbsent​(String namespace, String key, boolean value)` |
    `void` | `putIfAbsent​(String namespace, String key, double value)` |
    `void` | `putIfAbsent​(String namespace, String key, int value)` |
    `void` | `putIfAbsent​(String namespace, String key, String value)` |
    `void` | `serialize​(OutputStream out)` |

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ALGORITHM_PARAM

          public static final String ALGORITHM_PARAM

      See Also:
        Constant Field Values

    - #### TRAINER_TYPE_PARAM

          public static final String TRAINER_TYPE_PARAM

      See Also:
        Constant Field Values

    - #### ITERATIONS_PARAM

          public static final String ITERATIONS_PARAM

      See Also:
        Constant Field Values

    - #### CUTOFF_PARAM

          public static final String CUTOFF_PARAM

      See Also:
        Constant Field Values

    - #### THREADS_PARAM

          public static final String THREADS_PARAM

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TrainingParameters

          public TrainingParameters()

    - #### TrainingParameters

          public TrainingParameters​(TrainingParameters trainingParameters)

    - #### TrainingParameters

          public TrainingParameters​(Map<String,​String> map)

      Deprecated.

    - #### TrainingParameters

          public TrainingParameters​(InputStream in)
                             throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### algorithm

          public String algorithm​(String namespace)

      Retrieves the training algorithm name for a given name space.
      Returns:
        the name or null if not set.

    - #### algorithm

          public String algorithm()

      Retrieves the training algorithm name.
      Returns:
        the name or null if not set.

    - #### getSettings

          public Map<String,​String> getSettings​(String namespace)

      Deprecated.
      use `getObjectSettings(String)` instead
      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.

    - #### getSettings

          public Map<String,​String> getSettings()

      Deprecated.
      use `getObjectSettings()` instead
      Retrieves all parameters without a name space.
      Returns:
        the settings map

    - #### getObjectSettings

          public Map<String,​Object> getObjectSettings​(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 Map<String,​Object> getObjectSettings()

      Retrieves all parameters without a name space.
      Returns:
        the settings map

    - #### getParameters

          public TrainingParameters getParameters​(String namespace)

    - #### putIfAbsent

          public void putIfAbsent​(String namespace,
                                  String key,
                                  String value)

    - #### putIfAbsent

          public void putIfAbsent​(String key,
                                  String value)

    - #### putIfAbsent

          public void putIfAbsent​(String namespace,
                                  String key,
                                  int value)

    - #### putIfAbsent

          public void putIfAbsent​(String key,
                                  int value)

    - #### putIfAbsent

          public void putIfAbsent​(String namespace,
                                  String key,
                                  double value)

    - #### putIfAbsent

          public void putIfAbsent​(String key,
                                  double value)

    - #### putIfAbsent

          public void putIfAbsent​(String namespace,
                                  String key,
                                  boolean value)

    - #### putIfAbsent

          public void putIfAbsent​(String key,
                                  boolean value)

    - #### put

          public void put​(String namespace,
                          String key,
                          String value)

    - #### put

          public void put​(String key,
                          String value)

    - #### put

          public void put​(String namespace,
                          String key,
                          int value)

    - #### put

          public void put​(String key,
                          int value)

    - #### put

          public void put​(String namespace,
                          String key,
                          double value)

    - #### put

          public void put​(String key,
                          double value)

    - #### put

          public void put​(String namespace,
                          String key,
                          boolean value)

    - #### put

          public void put​(String key,
                          boolean value)

    - #### serialize

          public void serialize​(OutputStream out)
                         throws IOException

      Throws:
        `IOException`

    - #### getStringParameter

          public String getStringParameter​(String key,
                                           String defaultValue)

      get a String parameter. `ClassCastException` can be thrown if the value is not `String`
      Parameters:
        `key` -
        `defaultValue` -
      Returns:

    - #### getStringParameter

          public String getStringParameter​(String namespace,
                                           String key,
                                           String defaultValue)

      get a String parameter in the specified namespace. `ClassCastException` can be thrown if the value is not `String`
      Parameters:
        `namespace` -
        `key` -
        `defaultValue` -
      Returns:

    - #### getIntParameter

          public int getIntParameter​(String key,
                                     int defaultValue)

      get an Integer parameter
      Parameters:
        `key` -
        `defaultValue` -
      Returns:

    - #### getIntParameter

          public int getIntParameter​(String namespace,
                                     String key,
                                     int defaultValue)

      get an Integer parameter in the specified namespace
      Parameters:
        `namespace` -
        `key` -
        `defaultValue` -
      Returns:

    - #### getDoubleParameter

          public double getDoubleParameter​(String key,
                                           double defaultValue)

      get a Double parameter
      Parameters:
        `key` -
        `defaultValue` -
      Returns:

    - #### getDoubleParameter

          public double getDoubleParameter​(String namespace,
                                           String key,
                                           double defaultValue)

      get a Double parameter in the specified namespace
      Parameters:
        `namespace` -
        `key` -
        `defaultValue` -
      Returns:

    - #### getBooleanParameter

          public boolean getBooleanParameter​(String key,
                                             boolean defaultValue)

      get a Boolean parameter
      Parameters:
        `key` -
        `defaultValue` -
      Returns:

    - #### getBooleanParameter

          public boolean getBooleanParameter​(String namespace,
                                             String key,
                                             boolean defaultValue)

      get a Boolean parameter in the specified namespace
      Parameters:
        `namespace` -
        `key` -
        `defaultValue` -
      Returns:

    - #### defaultParams

          public static TrainingParameters defaultParams()