Package opennlp.tools.ml.model
Class AbstractModelReader
java.lang.Object
opennlp.tools.ml.model.AbstractModelReader
- Direct Known Subclasses:
- GenericModelReader,- GISModelReader,- NaiveBayesModelReader,- PerceptronModelReader
An abstract, basic implementation of a model reader.
- 
Constructor SummaryConstructorsConstructorDescriptionInitializes aAbstractModelReadervia aFile.AbstractModelReader(DataReader dataReader) Initializes aAbstractModelReadervia aDataReader.
- 
Method SummaryModifier and TypeMethodDescriptionabstract voidChecks the model type via the the underlyingDataReader.abstract AbstractModelConstructs amodel.getModel()doubleImplement as needed for the format the model is stored in.intreadInt()Implement as needed for the format the model is stored in.readUTF()Implement as needed for the format the model is stored in.
- 
Constructor Details- 
AbstractModelReaderInitializes aAbstractModelReadervia aFile.- Parameters:
- f- The- Filethat references the model to be read.
- Throws:
- IOException- Thrown if IO errors occurred.
 
- 
AbstractModelReaderInitializes aAbstractModelReadervia aDataReader.- Parameters:
- dataReader- The- DataReaderthat references the model to be read.
 
 
- 
- 
Method Details- 
readIntImplement as needed for the format the model is stored in.- Returns:
- Reads in an intvalue from the underlyingDataReader.
- Throws:
- IOException
 
- 
readDoubleImplement as needed for the format the model is stored in.- Returns:
- Reads in a doublevalue from the underlyingDataReader.
- Throws:
- IOException
 
- 
readUTFImplement as needed for the format the model is stored in.- Returns:
- Reads in an UTF-encoded Stringvalue from the underlyingDataReader.
- Throws:
- IOException
 
- 
getModel- Returns:
- Retrieves the read AbstractModelinstance.
- Throws:
- IOException- Thrown if IO errors occurred constructing the model.
 
- 
checkModelTypeChecks the model type via the the underlyingDataReader.- Throws:
- IOException- Thrown if IO errors occurred checking the model type.
 
- 
constructModelConstructs amodel.- Returns:
- A AbstractModelreconstructed from a model's (read) attributes.
- Throws:
- IOException- Thrown if IO errors occurred during (re-)construction.
 
 
-