opennlp.tools.util.model
Class ModelUtil

java.lang.Object
  extended by opennlp.tools.util.model.ModelUtil

public final class ModelUtil
extends Object

Utility class for handling of MaxentModels.


Method Summary
static void addCutoffAndIterations(Map<String,String> manifestInfoEntries, int cutoff, int iterations)
           
static TrainingParameters createTrainingParameters(int iterations, int cutoff)
          Note: Do not use this legacy support method, internal use only!
static byte[] read(InputStream in)
          Writes the provided InputStream into a byte array which is returned
static boolean validateOutcomes(opennlp.model.MaxentModel model, String... expectedOutcomes)
          Checks if the expected outcomes are all contained as outcomes in the given model.
static void writeModel(opennlp.model.AbstractModel model, OutputStream out)
          Writes the given model to the given OutputStream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeModel

public static void writeModel(opennlp.model.AbstractModel model,
                              OutputStream out)
                       throws IOException
Writes the given model to the given OutputStream. This methods does not closes the provided stream.

Parameters:
model - the model to be written
out - the stream the model should be written to
Throws:
IOException
{@link - IllegalArgumentException} in case one of the parameters is null

validateOutcomes

public static boolean validateOutcomes(opennlp.model.MaxentModel model,
                                       String... expectedOutcomes)
Checks if the expected outcomes are all contained as outcomes in the given model.

Parameters:
model -
expectedOutcomes -
Returns:
true if all expected outcomes are the only outcomes of the model.

read

public static byte[] read(InputStream in)
                   throws IOException
Writes the provided InputStream into a byte array which is returned

Parameters:
in - stream to read data for the byte array from
Returns:
byte array with the contents of the stream
Throws:
IOException - if an exception is thrown while reading from the provided InputStream

addCutoffAndIterations

public static void addCutoffAndIterations(Map<String,String> manifestInfoEntries,
                                          int cutoff,
                                          int iterations)

createTrainingParameters

public static TrainingParameters createTrainingParameters(int iterations,
                                                          int cutoff)
Note: Do not use this legacy support method, internal use only!

Parameters:
iterations - number of iterations
cutoff - cutoff threshold
Returns:
training parameters instance


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.