Class ModelUtil

Namespace
NOpenNLP.Tools.Util.Model
Assembly
NOpenNLP.Tools.dll

Utility class for handling of IMaxentModels.

public static class ModelUtil
Inheritance
ModelUtil
Inherited Members

Methods

AddCutoffAndIterations(Dictionary<string, string>, int, int)

public static void AddCutoffAndIterations(Dictionary<string, string> manifestInfoEntries, int cutoff, int iterations)

Parameters

manifestInfoEntries Dictionary<string, string>
cutoff int
iterations int

CreateDefaultTrainingParameters()

Creates the default training parameters in case they are not provided.

Note: Do not use this method, internal use only!

public static TrainingParameters CreateDefaultTrainingParameters()

Returns

TrainingParameters

training parameters instance

Read(Stream)

Writes the provided Stream into a byte array which is returned

public static byte[] Read(Stream @in)

Parameters

in Stream

stream to read data for the byte array from

Returns

byte[]

byte array with the contents of the stream

Exceptions

IOException

if an exception is thrown while reading from the provided Stream

ValidateOutcomes(IMaxentModel, params string[])

Checks if the expected outcomes are all contained as outcomes in the given model.

public static bool ValidateOutcomes(IMaxentModel model, params string[] expectedOutcomes)

Parameters

model IMaxentModel
expectedOutcomes string[]

Returns

bool

true if all expected outcomes are the only outcomes of the model.

WriteModel(IMaxentModel, Stream)

Writes the given model to the given Stream.

This methods does not closes the provided stream.

public static void WriteModel(IMaxentModel model, Stream @out)

Parameters

model IMaxentModel

the model to be written

out Stream

the stream the model should be written to

Exceptions

IOException
ArgumentNullException

in case one of the parameters is null