|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object opennlp.tools.util.model.BaseModel
public abstract class BaseModel
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
Field Summary | |
---|---|
protected Map<String,Object> |
artifactMap
|
protected static String |
MANIFEST_ENTRY
|
static String |
TRAINING_CUTOFF_PROPERTY
|
static String |
TRAINING_EVENTHASH_PROPERTY
|
static String |
TRAINING_ITERATIONS_PROPERTY
|
Constructor Summary | |
---|---|
protected |
BaseModel(String componentName,
InputStream in)
Initializes the current instance. |
protected |
BaseModel(String componentName,
String languageCode,
Map<String,String> manifestInfoEntries)
Initializes the current instance. |
Method Summary | |
---|---|
protected void |
createArtifactSerializers(Map<String,ArtifactSerializer> serializers)
Registers all ArtifactSerializer for their artifact file name extensions. |
protected ArtifactSerializer |
getArtifactSerializer(String resoruceName)
|
String |
getLanguage()
Retrieves the language code of the material which was used to train the model or x-unspecified if non was set. |
String |
getManifestProperty(String key)
Retrieves the value to the given key from the manifest.properties entry. |
Version |
getVersion()
Retrieves the OpenNLP version which was used to create the model. |
void |
serialize(OutputStream out)
Serializes the model to the given OutputStream . |
protected void |
setManifestProperty(String key,
String value)
Sets a given value for a given key to the manifest.properties entry. |
protected void |
validateArtifactMap()
Validates the parsed artifacts. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String MANIFEST_ENTRY
public static final String TRAINING_CUTOFF_PROPERTY
public static final String TRAINING_ITERATIONS_PROPERTY
public static final String TRAINING_EVENTHASH_PROPERTY
protected final Map<String,Object> artifactMap
Constructor Detail |
---|
protected BaseModel(String componentName, String languageCode, Map<String,String> manifestInfoEntries)
languageCode
- manifestInfoEntries
- additional information in the manifestprotected BaseModel(String componentName, InputStream in) throws IOException, InvalidFormatException
in
-
IOException
InvalidFormatException
Method Detail |
---|
protected ArtifactSerializer getArtifactSerializer(String resoruceName)
protected void createArtifactSerializers(Map<String,ArtifactSerializer> serializers)
ArtifactSerializer
for their artifact file name extensions.
The registered ArtifactSerializer
are used to create and serialize
resources in the model package.
Override this method to register custom ArtifactSerializer
s.
Note:
Subclasses should generally invoke super.createArtifactSerializers at the beginning
of this method.
This method is called during construction.
serializers
- the key of the map is the file extension used to lookup
the ArtifactSerializer
.protected void validateArtifactMap() throws InvalidFormatException
InvalidFormatException
.
Note:
Subclasses should generally invoke super.validateArtifactMap at the beginning
of this method.
InvalidFormatException
public final String getManifestProperty(String key)
key
-
protected final void setManifestProperty(String key, String value)
key
- value
- public final String getLanguage()
public final Version getVersion()
public final void serialize(OutputStream out) throws IOException
OutputStream
.
out
- stream to write the model to
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |