Package opennlp.tools.ml.maxent.io

# Class GISModelReader

java.lang.Object
opennlp.tools.ml.model.AbstractModelReader
opennlp.tools.ml.maxent.io.GISModelReader

Direct Known Subclasses:
  `BinaryGISModelReader`, `QNModelReader`

public class GISModelReader extends AbstractModelReader
The base class for readers of `GIS models`.

Format for the GIS maxent info (.mei) files:

GIS (model type identifier)
1. # of parameters (`int`)
2. the correction constant (`int`)
3. the correction constant parameter (`double`)
4. # of outcomes (`int`)
* list of outcome names (`String`)
5. # of different types of outcome patterns (`int`)
* list of (`int` `int[]`)
[# of predicates for which outcome pattern is true] [outcome pattern]
6. # of predicates (`int`)
* list of predicate names (`String`)

See Also:
  - `GISModel`
  - `AbstractModelReader`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GISModelReader(File file)`
  Initializes a `GISModelReader` via a `File`.
  `GISModelReader(DataReader dataReader)`
  Initializes a `GISModelReader` via a `DataReader`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `checkModelType()`
  Checks the model type via the the underlying `DataReader`.
  `AbstractModel`
  `constructModel()`
  Retrieves a model from disk.

  ### Methods inherited from class opennlp.tools.ml.model.AbstractModelReader

  `getModel, readDouble, readInt, readUTF`

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

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

- ## Constructor Details

  - ### GISModelReader

    public GISModelReader(File file) throws IOException
    Initializes a `GISModelReader` via a `File`.
    Parameters:
      `file` - The `File` that references the model to be read.
    Throws:
      `IOException` - Thrown if IO errors occurred.

  - ### GISModelReader

    public GISModelReader(DataReader dataReader)
    Initializes a `GISModelReader` via a `DataReader`.
    Parameters:
      `dataReader` - The `DataReader` that references the model to be read.

- ## Method Details

  - ### constructModel

    public AbstractModel constructModel() throws IOException
    Retrieves a model from disk.

    If you are creating a reader for a format which won't work with this (perhaps a database or xml file), override this method and ignore the other methods provided in this abstract class.

    Specified by:
      `constructModel` in class `AbstractModelReader`
    Returns:
      The `GISModel` stored in the format and location specified to this `GISModelReader` (usually via its constructor).
    Throws:
      `IOException` - Thrown if IO errors occurred during (re-)construction.

  - ### checkModelType

    public void checkModelType() throws IOException
    Description copied from class: `AbstractModelReader`
    Checks the model type via the the underlying `DataReader`.
    Specified by:
      `checkModelType` in class `AbstractModelReader`
    Throws:
      `IOException` - Thrown if IO errors occurred checking the model type.