Class FeedforwardDependencyModel
java.lang.Object
opennlp.tools.util.model.BaseModel
opennlp.tools.depparse.FeedforwardDependencyModel
- All Implemented Interfaces:
Serializable, opennlp.tools.util.model.ArtifactProvider
The persisted form of a trained
FeedforwardDependencyParser: the network
weights plus the standard model manifest, serialized and loaded through the same
BaseModel machinery as every other tool model.
The weights are not modified after construction or loading. A model can be
shared between threads and between parsers; refine trains a copy and returns a new 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
ConstructorsConstructorDescriptionFeedforwardDependencyModel(File modelFile) Initializes aFeedforwardDependencyModelfrom a serialized model file.Initializes aFeedforwardDependencyModelfrom a serialized model.FeedforwardDependencyModel(Path modelPath) Initializes aFeedforwardDependencyModelfrom a serialized model file. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the beam size a parser uses when none is given: the beam size the model was refined with, which the manifest records under "BeamSize", or1(greedy) for a model that was not refined.Methods inherited from class BaseModel
deserialize, getArtifact, getLanguage, getManifestProperty, getVersion, isLoadedFromSerialized, serialize, serialize, serialize
-
Constructor Details
-
FeedforwardDependencyModel
Initializes aFeedforwardDependencyModelfrom 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, or if it holds the model package of another component; the cause is anInvalidFormatException.
-
FeedforwardDependencyModel
Initializes aFeedforwardDependencyModelfrom 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, or if it holds the model package of another component; the cause is anInvalidFormatException.
-
FeedforwardDependencyModel
Initializes aFeedforwardDependencyModelfrom 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, or if it holds the model package of another component; the cause is anInvalidFormatException.
-
-
Method Details
-
getBeamSize
public int getBeamSize()Returns the beam size a parser uses when none is given: the beam size the model was refined with, which the manifest records under "BeamSize", or1(greedy) for a model that was not refined.- Returns:
- The beam size. Always positive.
-