Package opennlp.tools.util
Class BaseToolFactory
- java.lang.Object
-
- opennlp.tools.util.BaseToolFactory
-
- Direct Known Subclasses:
ChunkerFactory
,POSTaggerFactory
,TokenizerFactory
,TokenNameFinderFactory
public abstract class BaseToolFactory extends java.lang.Object
Base class for all tool factories. Extensions of this class should:- implement an empty constructor (TODO is it necessary?)
- implement a constructor that takes the
ArtifactProvider
and callsBaseToolFactory(Map)
- override
createArtifactMap()
andcreateArtifactSerializersMap()
methods if necessary.
-
-
Constructor Summary
Constructors Constructor Description BaseToolFactory()
All sub-classes should have an empty constructor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static BaseToolFactory
create(java.lang.Class<? extends BaseToolFactory> factoryClass, ArtifactProvider artifactProvider)
static BaseToolFactory
create(java.lang.String subclassName, ArtifactProvider artifactProvider)
java.util.Map<java.lang.String,java.lang.Object>
createArtifactMap()
Creates aMap
with pairs of keys and objects.java.util.Map<java.lang.String,ArtifactSerializer>
createArtifactSerializersMap()
Creates aMap
with pairs of keys andArtifactSerializer
.java.util.Map<java.lang.String,java.lang.String>
createManifestEntries()
Creates the manifest entries that will be added to the model manifestabstract void
validateArtifactMap()
Validates the parsed artifacts.
-
-
-
Method Detail
-
createArtifactSerializersMap
public java.util.Map<java.lang.String,ArtifactSerializer> createArtifactSerializersMap()
Creates aMap
with pairs of keys andArtifactSerializer
. The models implementation should call this method fromBaseModel#createArtifactSerializersMap
The base implementation will return a
HashMap
that should be populated by sub-classes.
-
createArtifactMap
public java.util.Map<java.lang.String,java.lang.Object> createArtifactMap()
Creates aMap
with pairs of keys and objects. The models implementation should call this constructor that creates a model programmatically.The base implementation will return a
HashMap
that should be populated by sub-classes.
-
createManifestEntries
public java.util.Map<java.lang.String,java.lang.String> createManifestEntries()
Creates the manifest entries that will be added to the model manifest- Returns:
- the manifest entries to added to the model manifest
-
validateArtifactMap
public abstract void validateArtifactMap() throws InvalidFormatException
Validates the parsed artifacts. If something is not valid subclasses should throw anInvalidFormatException
. Note: Subclasses should generally invoke super.validateArtifactMap at the beginning of this method.- Throws:
InvalidFormatException
-
create
public static BaseToolFactory create(java.lang.String subclassName, ArtifactProvider artifactProvider) throws InvalidFormatException
- Throws:
InvalidFormatException
-
create
public static BaseToolFactory create(java.lang.Class<? extends BaseToolFactory> factoryClass, ArtifactProvider artifactProvider) throws InvalidFormatException
- Throws:
InvalidFormatException
-
-