Package opennlp.uima.util

# Class OpennlpUtil

java.lang.Object
opennlp.uima.util.OpennlpUtil

public final class OpennlpUtil extends Object
Provides utility methods for OpenNLP's maxent library.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static byte[]`
  `loadBytes(File inFile)`
  Loads data from a given `File`.
  `static TrainingParameters`
  `loadTrainingParams(String trainingFilePath, boolean isSequenceTrainingAllowed)`
  Loads data from the specified training parameters `file`.
  `static void`
  `serialize(BaseModel model, File modelFile)`
  Serializes a `GIS model` and writes it to the given `File`.

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

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

- ## Method Details

  - ### serialize

    public static void serialize(BaseModel model, File modelFile) throws IOException
    Serializes a `GIS model` and writes it to the given `File`.
    Parameters:
      `model` - The `BaseModel` to serialize.
      `modelFile` - The `File` to serialize into.
    Throws:
      `IOException` - Thrown if IO errors occurred.

  - ### loadBytes

    public static byte[] loadBytes(File inFile) throws IOException
    Loads data from a given `File`.
    Parameters:
      `inFile` - The `File` to read bytes from.
    Returns:
      The bytes that have been read.
    Throws:
      `IOException` - Thrown if IO errors occurred.

  - ### loadTrainingParams

    public static TrainingParameters loadTrainingParams(String trainingFilePath, boolean isSequenceTrainingAllowed) throws org.apache.uima.resource.ResourceInitializationException
    Loads data from the specified training parameters `file`.
    Parameters:
      `trainingFilePath` - The path to the `File` to load the training parameters from.
      `isSequenceTrainingAllowed` - Whether the `TrainerFactory.TrainerType.SEQUENCE_TRAINER` method is allowed or not.
    Returns:
      The `TrainingParameters` that have been read.
    Throws:
      `org.apache.uima.resource.ResourceInitializationException` - Thrown if IO errors occurred or the `trainingFilePath` does not reference a valid training parameters file.