Class DependencyModel
java.lang.Object
opennlp.tools.util.model.BaseModel
opennlp.tools.depparse.DependencyModel
- All Implemented Interfaces:
Serializable, opennlp.tools.util.model.ArtifactProvider
The persisted form of a trained
DependencyParserME: the transition
classification model plus the standard model manifest, serialized and loaded through
the same BaseModel machinery as every other tool model.- Since:
- 3.0.0
- See Also:
-
Field Summary
Fields inherited from class BaseModel
TRAINING_CUTOFF_PROPERTY, TRAINING_EVENTHASH_PROPERTY, TRAINING_ITERATIONS_PROPERTY -
Constructor Summary
ConstructorsConstructorDescriptionDependencyModel(File modelFile) Initializes aDependencyModelfrom a serialized model file.Initializes aDependencyModelfrom a serialized model.DependencyModel(String languageCode, opennlp.tools.ml.model.MaxentModel parserModel, Map<String, String> manifestInfoEntries) Initializes aDependencyModelfrom a trained transition model.DependencyModel(Path modelPath) Initializes aDependencyModelfrom a serialized model file. -
Method Summary
Methods inherited from class BaseModel
deserialize, getArtifact, getLanguage, getManifestProperty, getVersion, isLoadedFromSerialized, serialize, serialize, serialize
-
Constructor Details
-
DependencyModel
public DependencyModel(String languageCode, opennlp.tools.ml.model.MaxentModel parserModel, Map<String, String> manifestInfoEntries) Initializes aDependencyModelfrom a trained transition model.- Parameters:
languageCode- The ISO language code of the training data. Must not benull.parserModel- The transition classification model. Must not benull.manifestInfoEntries- Additional entries for the manifest, ornull.- Throws:
IllegalArgumentException- Thrown iflanguageCodeorparserModelisnull.
-
DependencyModel
Initializes aDependencyModelfrom a serialized model.- Parameters:
in- The stream to read the model from. Must not benull.- Throws:
IOException- Thrown if reading fails or the content is not a valid model.IllegalArgumentException- Thrown ifinisnull.
-
DependencyModel
Initializes aDependencyModelfrom a serialized model file.- Parameters:
modelFile- The file to read the model from. Must not benull.- Throws:
IOException- Thrown if reading fails or the content is not a valid model.IllegalArgumentException- Thrown ifmodelFileisnull.
-
DependencyModel
Initializes aDependencyModelfrom a serialized model file.- Parameters:
modelPath- The path to read the model from. Must not benull.- Throws:
IOException- Thrown if reading fails or the content is not a valid model.IllegalArgumentException- Thrown ifmodelPathisnull.
-
-
Method Details
-
getParserModel
public opennlp.tools.ml.model.MaxentModel getParserModel()- Returns:
- The transition classification model. Never
null.
-