Package opennlp.tools.util.model
Class BaseModel
java.lang.Object
opennlp.tools.util.model.BaseModel
- All Implemented Interfaces:
Serializable
,ArtifactProvider
- Direct Known Subclasses:
ChunkerModel
,POSModel
,TokenizerModel
,TokenNameFinderModel
This model is a common based which can be used by the components
model classes.
TODO:
Provide sub classes access to serializers already in constructor
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription<T> T
getArtifact
(String key) Gets an artifact by namefinal String
Retrieves the language code of the material which was used to train the model or x-unspecified if non was set.final String
Retrieves the value to the given key from the manifest.properties entry.final Version
Retrieves the OpenNLP version which was used to create the model.boolean
Indicates if this provider was loaded from serialized.final void
final void
serialize
(OutputStream out) Serializes the model to the givenOutputStream
.final void
-
Field Details
-
TRAINING_CUTOFF_PROPERTY
- See Also:
-
TRAINING_ITERATIONS_PROPERTY
- See Also:
-
TRAINING_EVENTHASH_PROPERTY
- See Also:
-
-
Method Details
-
getManifestProperty
Retrieves the value to the given key from the manifest.properties entry.- Specified by:
getManifestProperty
in interfaceArtifactProvider
- Parameters:
key
-- Returns:
- the value
-
getLanguage
Retrieves the language code of the material which was used to train the model or x-unspecified if non was set.- Specified by:
getLanguage
in interfaceArtifactProvider
- Returns:
- the language code of this model
-
getVersion
Retrieves the OpenNLP version which was used to create the model.- Returns:
- the version
-
serialize
Serializes the model to the givenOutputStream
.- Parameters:
out
- stream to write the model to- Throws:
IOException
-
serialize
- Throws:
IOException
-
serialize
- Throws:
IOException
-
getArtifact
Description copied from interface:ArtifactProvider
Gets an artifact by name- Specified by:
getArtifact
in interfaceArtifactProvider
-
isLoadedFromSerialized
public boolean isLoadedFromSerialized()Description copied from interface:ArtifactProvider
Indicates if this provider was loaded from serialized. It is useful, for example, while validating artifacts: you can skip the time consuming ones if they where already validated during the serialization.- Specified by:
isLoadedFromSerialized
in interfaceArtifactProvider
- Returns:
- true if this model was loaded from serialized
-