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
 
 public abstract class BaseModel extends Object implements ArtifactProvider, Serializable 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:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringTRAINING_CUTOFF_PROPERTYstatic StringTRAINING_EVENTHASH_PROPERTYstatic StringTRAINING_ITERATIONS_PROPERTY
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TgetArtifact(String key)Gets an artifact by nameStringgetLanguage()Retrieves the language code of the material which was used to train the model or x-unspecified if non was set.StringgetManifestProperty(String key)Retrieves the value to the given key from the manifest.properties entry.VersiongetVersion()Retrieves the OpenNLP version which was used to create the model.booleanisLoadedFromSerialized()Indicates if this provider was loaded from serialized.voidserialize(File model)voidserialize(OutputStream out)Serializes the model to the givenOutputStream.voidserialize(Path model)
 
- 
- 
- 
Field Detail- 
TRAINING_CUTOFF_PROPERTYpublic static final String TRAINING_CUTOFF_PROPERTY - See Also:
- Constant Field Values
 
 - 
TRAINING_ITERATIONS_PROPERTYpublic static final String TRAINING_ITERATIONS_PROPERTY - See Also:
- Constant Field Values
 
 - 
TRAINING_EVENTHASH_PROPERTYpublic static final String TRAINING_EVENTHASH_PROPERTY - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getManifestPropertypublic final String getManifestProperty(String key) Retrieves the value to the given key from the manifest.properties entry.- Specified by:
- getManifestPropertyin interface- ArtifactProvider
- Parameters:
- key-
- Returns:
- the value
 
 - 
getLanguagepublic final String getLanguage() Retrieves the language code of the material which was used to train the model or x-unspecified if non was set.- Specified by:
- getLanguagein interface- ArtifactProvider
- Returns:
- the language code of this model
 
 - 
getVersionpublic final Version getVersion() Retrieves the OpenNLP version which was used to create the model.- Returns:
- the version
 
 - 
serializepublic final void serialize(OutputStream out) throws IOException Serializes the model to the givenOutputStream.- Parameters:
- out- stream to write the model to
- Throws:
- IOException
 
 - 
serializepublic final void serialize(File model) throws IOException - Throws:
- IOException
 
 - 
serializepublic final void serialize(Path model) throws IOException - Throws:
- IOException
 
 - 
getArtifactpublic <T> T getArtifact(String key) Description copied from interface:ArtifactProviderGets an artifact by name- Specified by:
- getArtifactin interface- ArtifactProvider
 
 - 
isLoadedFromSerializedpublic boolean isLoadedFromSerialized() Description copied from interface:ArtifactProviderIndicates 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:
- isLoadedFromSerializedin interface- ArtifactProvider
- Returns:
- true if this model was loaded from serialized
 
 
- 
 
-