Klasse ModelUtil

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

public final class ModelUtil extends Object
Utility class for handling of models.
  • Methodendetails

    • writeModel

      public static void writeModel(MaxentModel model, OutputStream out) throws IOException, IllegalArgumentException
      Writes the given MaxentModel to the specified OutputStream.

      Note: The provided stream is not closed.

      Parameter:
      model - The model to be written.
      out - the stream to be used for writing.
      Löst aus:
      IOException - Thrown if IO errors occurred.
      IllegalArgumentException - Thrown if one of the parameters is null.
    • validateOutcomes

      public static boolean validateOutcomes(MaxentModel model, String... expectedOutcomes)
      Checks if the expectedOutcomes are all contained as outcomes in the given model.
      Parameter:
      model - A valid MaxentModel instance.
      expectedOutcomes - The outcomes to be checked for.
      Gibt zurück:
      true if all expected outcomes are the only outcomes of the model false otherwise.
    • read

      public static byte[] read(InputStream in) throws IOException
      Reads from the provided InputStream into a byte array.
      Parameter:
      in - A valid, open InputStream to read data from.
      Gibt zurück:
      A byte[] with the data read.
      Löst aus:
      IOException - Thrown if IO errors occurred.
    • addCutoffAndIterations

      public static void addCutoffAndIterations(Map<String,String> manifestInfoEntries, int cutoff, int iterations)
      Adds cutoff and iterations to manifestInfoEntries.
      Parameter:
      manifestInfoEntries - A Map representing a manifest.properties config.
      cutoff - The cut-off value to set. Must be greater than 0.
      iterations - The number of iterations to set. Must be greater than 0.
    • createDefaultTrainingParameters

      @Internal public static TrainingParameters createDefaultTrainingParameters()
      Creates the default TrainingParameters in case they are not provided.

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

      Gibt zurück:
      The TrainingParameters instance with default configuration.