Package opennlp.tools.util
Class BaseToolFactory
- java.lang.Object
- 
- opennlp.tools.util.BaseToolFactory
 
- 
- Direct Known Subclasses:
- ChunkerFactory,- DoccatFactory,- LanguageDetectorFactory,- LemmatizerFactory,- POSTaggerFactory,- SentenceDetectorFactory,- TokenizerFactory,- TokenNameFinderFactory
 
 public abstract class BaseToolFactory extends Object Base class for all toolfactories.Extensions of this class should: - implement an empty constructor,
- implement a constructor that takes the ArtifactProvider},
- override createArtifactMap()andcreateArtifactSerializersMap()methods if necessary.
 
- 
- 
Constructor SummaryConstructors Constructor Description BaseToolFactory()All subclasses should have an empty constructor
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static BaseToolFactorycreate(Class<? extends BaseToolFactory> factoryClass, ArtifactProvider artifactProvider)Instantiates aBaseToolFactoryvia a givensubclassName.static BaseToolFactorycreate(String subclassName, ArtifactProvider artifactProvider)Instantiates aBaseToolFactoryvia a givensubclassName.Map<String,Object>createArtifactMap()A model's implementation should call this constructor that creates a model programmatically.Map<String,ArtifactSerializer>createArtifactSerializersMap()Creates aMapwith pairs of keys andArtifactSerializer.Map<String,String>createManifestEntries()abstract voidvalidateArtifactMap()Validates the parsed artifacts.
 
- 
- 
- 
Method Detail- 
createArtifactSerializersMappublic Map<String,ArtifactSerializer> createArtifactSerializersMap() Creates aMapwith pairs of keys andArtifactSerializer. The models implementation should call this method fromBaseModel#createArtifactSerializersMap.The base implementation will return a HashMapthat should be populated by subclasses.
 - 
createArtifactMappublic Map<String,Object> createArtifactMap() A model's implementation should call this constructor that creates a model programmatically.The base implementation will return a HashMapthat should be populated by subclasses.- Returns:
- Retrieves a Mapwith pairs of keys and objects.
 
 - 
createManifestEntriespublic Map<String,String> createManifestEntries() - Returns:
- Retrieves the manifest entries to be added to the model manifest.
 
 - 
validateArtifactMappublic abstract void validateArtifactMap() throws InvalidFormatExceptionValidates the parsed artifacts.Note: Subclasses should generally invoke super.validateArtifactMapat the beginning of this method.- Throws:
- InvalidFormatException- Thrown if validation found invalid states.
 
 - 
createpublic static BaseToolFactory create(String subclassName, ArtifactProvider artifactProvider) throws InvalidFormatException Instantiates aBaseToolFactoryvia a givensubclassName.- Parameters:
- subclassName- The class name used for instantiation. The- ExtensionLoadermechanism is applied to load the requested- subclassName.
- artifactProvider- The- ArtifactProviderto be used.
- Returns:
- A valid BaseToolFactoryinstance.
- Throws:
- InvalidFormatException- Thrown if the- ExtensionLoadermechanism failed to create the factory associated with- subclassName.
 
 - 
createpublic static BaseToolFactory create(Class<? extends BaseToolFactory> factoryClass, ArtifactProvider artifactProvider) throws InvalidFormatException Instantiates aBaseToolFactoryvia a givensubclassName.- Parameters:
- factoryClass- The class used for instantiation. The no-arg constructor of that class will be used to create and init the resulting object.
- artifactProvider- The- ArtifactProviderto be used.
- Returns:
- A valid BaseToolFactoryinstance.
- Throws:
- InvalidFormatException- Thrown if the- ExtensionLoadermechanism failed to create the factory associated with- subclassName.
 
 
- 
 
-