Package opennlp.tools.util.model
Class BaseModel
java.lang.Object
opennlp.tools.util.model.BaseModel
- All Implemented Interfaces:
- Serializable,- ArtifactProvider
- Direct Known Subclasses:
- ChunkerModel,- DoccatModel,- LanguageDetectorModel,- LemmatizerModel,- ParserModel,- POSModel,- SentenceModel,- TokenizerModel,- TokenNameFinderModel
This is a common base model which can be used by the components' specific
 model classes.
- See Also:
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescription<T> TgetArtifact(String key) final Stringfinal Stringfinal VersionbooleanIndicates if this provider was loaded from a serialized form.final voidSerializes the model to the specifiedFile.final voidserialize(OutputStream out) Serializes the model to the givenOutputStream.final voidSerializes the model to the specifiedPath.
- 
Field Details- 
TRAINING_CUTOFF_PROPERTY- See Also:
 
- 
TRAINING_ITERATIONS_PROPERTY- See Also:
 
- 
TRAINING_EVENTHASH_PROPERTY- See Also:
 
 
- 
- 
Method Details- 
getManifestProperty- Specified by:
- getManifestPropertyin interface- ArtifactProvider
- Parameters:
- key- A string identifying an element.
- Returns:
- Retrieves the value for the given keyfrom themanifest.properties.
 
- 
getLanguage- Specified by:
- getLanguagein interface- ArtifactProvider
- Returns:
- Retrieves the language code of the material which was used to train a model
         or 'x-unspecified'if non was set.
 
- 
getVersion- Returns:
- Retrieves the OpenNLP Versionwhich was used to create the model.
 
- 
serializeSerializes the model to the givenOutputStream.- Parameters:
- out- The- OutputStreamto write the model to.
- Throws:
- IOException- Thrown if IO errors occurred.
- IllegalStateException- Thrown if- loadArtifactSerializers()was not called in a subclass constructor.
 
- 
serializeSerializes the model to the specifiedFile.- Parameters:
- f- The write-accessible- Fileto write the model to.
- Throws:
- IOException- Thrown if IO errors occurred.
- IllegalStateException- Thrown if- loadArtifactSerializers()was not called in a subclass constructor.
 
- 
serializeSerializes the model to the specifiedPath.- Parameters:
- p- The write-accessible- Pathto write the model to.
- Throws:
- IOException- Thrown if IO errors occurred.
- IllegalStateException- Thrown if- loadArtifactSerializers()was not called in a subclass constructor.
 
- 
getArtifact- Specified by:
- getArtifactin interface- ArtifactProvider
- Returns:
- Gets an artifact by an identifying key or name.
 
- 
isLoadedFromSerializedpublic boolean isLoadedFromSerialized()Description copied from interface:ArtifactProviderIndicates if this provider was loaded from a serialized form.It is useful, for example, during the validation of artifacts: Skip the time-consuming ones if those were already validated during the serialization process. - Specified by:
- isLoadedFromSerializedin interface- ArtifactProvider
- Returns:
- trueif this model was loaded from a serialized form,- falseotherwise.
 
 
-