Class AbstractModelReader

java.lang.Object
opennlp.tools.ml.model.AbstractModelReader
Direct Known Subclasses:
GenericModelReader, GISModelReader, NaiveBayesModelReader, PerceptronModelReader

public abstract class AbstractModelReader extends Object
An abstract, basic implementation of a model reader.
  • Constructor Details

  • Method Details

    • readInt

      public int readInt() throws IOException
      Implement as needed for the format the model is stored in.
      Returns:
      Reads in an int value from the underlying DataReader.
      Throws:
      IOException
    • readDouble

      public double readDouble() throws IOException
      Implement as needed for the format the model is stored in.
      Returns:
      Reads in a double value from the underlying DataReader.
      Throws:
      IOException
    • readUTF

      public String readUTF() throws IOException
      Implement as needed for the format the model is stored in.
      Returns:
      Reads in an UTF-encoded String value from the underlying DataReader.
      Throws:
      IOException
    • getModel

      public AbstractModel getModel() throws IOException
      Returns:
      Retrieves the read AbstractModel instance.
      Throws:
      IOException - Thrown if IO errors occurred constructing the model.
    • checkModelType

      public abstract void checkModelType() throws IOException
      Checks the model type via the the underlying DataReader.
      Throws:
      IOException - Thrown if IO errors occurred checking the model type.
    • constructModel

      public abstract AbstractModel constructModel() throws IOException
      Constructs a model.
      Returns:
      A AbstractModel reconstructed from a model's (read) attributes.
      Throws:
      IOException - Thrown if IO errors occurred during (re-)construction.