Class TrainingParameters

Namespace
NOpenNLP.Tools.Util
Assembly
NOpenNLP.Tools.dll
public class TrainingParameters
Inheritance
TrainingParameters
Inherited Members

Constructors

TrainingParameters()

public TrainingParameters()

TrainingParameters(TrainingParameters)

public TrainingParameters(TrainingParameters trainingParameters)

Parameters

trainingParameters TrainingParameters

TrainingParameters(IDictionary<string, string>)

Initializes the parameters from a string map, inferring each value's type.

[Obsolete("Use one of the other constructors instead.")]
public TrainingParameters(IDictionary<string, string> map)

Parameters

map IDictionary<string, string>

TrainingParameters(Stream)

public TrainingParameters(Stream @in)

Parameters

in Stream

Exceptions

IOException

if the parameters cannot be read

Fields

ALGORITHM_PARAM

public const string ALGORITHM_PARAM = "Algorithm"

Field Value

string

CUTOFF_PARAM

public const string CUTOFF_PARAM = "Cutoff"

Field Value

string

ITERATIONS_PARAM

public const string ITERATIONS_PARAM = "Iterations"

Field Value

string

THREADS_PARAM

public const string THREADS_PARAM = "Threads"

Field Value

string

TRAINER_TYPE_PARAM

public const string TRAINER_TYPE_PARAM = "TrainerType"

Field Value

string

Methods

Algorithm()

Retrieves the training algorithm name.

public string? Algorithm()

Returns

string

the name or null if not set.

Algorithm(string?)

Retrieves the training algorithm name for a given name space.

public string? Algorithm(string? namespace_)

Parameters

namespace_ string

Returns

string

the name or null if not set.

DefaultParams()

public static TrainingParameters DefaultParams()

Returns

TrainingParameters

GetBooleanParameter(string, bool)

Gets a boolean parameter.

public bool GetBooleanParameter(string key, bool defaultValue)

Parameters

key string
defaultValue bool

Returns

bool

GetBooleanParameter(string?, string, bool)

Gets a boolean parameter in the specified namespace.

public bool GetBooleanParameter(string? namespace_, string key, bool defaultValue)

Parameters

namespace_ string
key string
defaultValue bool

Returns

bool

GetDoubleParameter(string, double)

Gets a double parameter.

public double GetDoubleParameter(string key, double defaultValue)

Parameters

key string
defaultValue double

Returns

double

GetDoubleParameter(string?, string, double)

Gets a double parameter in the specified namespace.

public double GetDoubleParameter(string? namespace_, string key, double defaultValue)

Parameters

namespace_ string
key string
defaultValue double

Returns

double

GetIntParameter(string, int)

Gets an integer parameter.

public int GetIntParameter(string key, int defaultValue)

Parameters

key string
defaultValue int

Returns

int

GetIntParameter(string?, string, int)

Gets an integer parameter in the specified namespace.

public int GetIntParameter(string? namespace_, string key, int defaultValue)

Parameters

namespace_ string
key string
defaultValue int

Returns

int

GetObjectSettings()

Retrieves all parameters without a name space.

public IDictionary<string, object> GetObjectSettings()

Returns

IDictionary<string, object>

the settings map

GetObjectSettings(string?)

Retrieves a map with the training parameters which have the passed name space.

public IDictionary<string, object> GetObjectSettings(string? namespace_)

Parameters

namespace_ string

the name space, or null for the parameters without one

Returns

IDictionary<string, object>

a parameter map which can be passed to the train and validate methods.

GetParameters(string?)

public TrainingParameters GetParameters(string? namespace_)

Parameters

namespace_ string

Returns

TrainingParameters

GetSettings()

Retrieves all parameters without a name space.

[Obsolete("Use GetObjectSettings() instead.")]
public IDictionary<string, string> GetSettings()

Returns

IDictionary<string, string>

the settings map

GetSettings(string?)

Retrieves a map with the training parameters which have the passed name space.

[Obsolete("Use GetObjectSettings(string) instead.")]
public IDictionary<string, string> GetSettings(string? namespace_)

Parameters

namespace_ string

the name space, or null for the parameters without one

Returns

IDictionary<string, string>

a parameter map which can be passed to the train and validate methods.

GetStringParameter(string, string?)

Gets a string parameter.

An InvalidCastException can be thrown if the value is not a string.

public string? GetStringParameter(string key, string? defaultValue)

Parameters

key string
defaultValue string

Returns

string

GetStringParameter(string?, string, string?)

Gets a string parameter in the specified namespace.

An InvalidCastException can be thrown if the value is not a string.

public string? GetStringParameter(string? namespace_, string key, string? defaultValue)

Parameters

namespace_ string
key string
defaultValue string

Returns

string

Put(string, bool)

public void Put(string key, bool value)

Parameters

key string
value bool

Put(string, double)

public void Put(string key, double value)

Parameters

key string
value double

Put(string, int)

public void Put(string key, int value)

Parameters

key string
value int

Put(string, string)

public void Put(string key, string value)

Parameters

key string
value string

Put(string?, string, bool)

public void Put(string? namespace_, string key, bool value)

Parameters

namespace_ string
key string
value bool

Put(string?, string, double)

public void Put(string? namespace_, string key, double value)

Parameters

namespace_ string
key string
value double

Put(string?, string, int)

public void Put(string? namespace_, string key, int value)

Parameters

namespace_ string
key string
value int

Put(string?, string, string)

public void Put(string? namespace_, string key, string value)

Parameters

namespace_ string
key string
value string

PutIfAbsent(string, bool)

public void PutIfAbsent(string key, bool value)

Parameters

key string
value bool

PutIfAbsent(string, double)

public void PutIfAbsent(string key, double value)

Parameters

key string
value double

PutIfAbsent(string, int)

public void PutIfAbsent(string key, int value)

Parameters

key string
value int

PutIfAbsent(string, string)

public void PutIfAbsent(string key, string value)

Parameters

key string
value string

PutIfAbsent(string?, string, bool)

public void PutIfAbsent(string? namespace_, string key, bool value)

Parameters

namespace_ string
key string
value bool

PutIfAbsent(string?, string, double)

public void PutIfAbsent(string? namespace_, string key, double value)

Parameters

namespace_ string
key string
value double

PutIfAbsent(string?, string, int)

public void PutIfAbsent(string? namespace_, string key, int value)

Parameters

namespace_ string
key string
value int

PutIfAbsent(string?, string, string)

public void PutIfAbsent(string? namespace_, string key, string value)

Parameters

namespace_ string
key string
value string

Serialize(Stream)

public void Serialize(Stream @out)

Parameters

out Stream

Exceptions

IOException

if the parameters cannot be written