BaseToolFactory (Apache OpenNLP :: Core :: Runtime 3.0.0-M4 API)
Description: declaration: package: opennlp.tools.util, class: BaseToolFactory

Package opennlp.tools.util

# Class BaseToolFactory

java.lang.Object
opennlp.tools.util.BaseToolFactory

Direct Known Subclasses:
  `BPETokenizerFactory`, `ChunkerFactory`, `DoccatFactory`, `LanguageDetectorFactory`, `LemmatizerFactory`, `POSTaggerFactory`, `SentenceDetectorFactory`, `SentimentFactory`, `TokenizerFactory`, `TokenNameFinderFactory`

public abstract class BaseToolFactory extends Object
Base class for all tool `factories`.

Extensions of this class should:

- implement an empty constructor,
- implement a constructor that takes the `ArtifactProvider`},
- override `createArtifactMap()` and `createArtifactSerializersMap()` methods if necessary.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BaseToolFactory()`
  All subclasses should have an empty constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static BaseToolFactory`
  `create(Class<? extends BaseToolFactory> factoryClass, opennlp.tools.util.model.ArtifactProvider artifactProvider)`
  Instantiates a `BaseToolFactory` via a given `subclassName`.
  `static BaseToolFactory`
  `create(String subclassName, opennlp.tools.util.model.ArtifactProvider artifactProvider)`
  Instantiates a `BaseToolFactory` via a given `subclassName`.
  `Map<String,Object>`
  `createArtifactMap()`
  A model's implementation should call this constructor that creates a model programmatically.
  `Map<String,opennlp.tools.util.model.ArtifactSerializer<?>>`
  `createArtifactSerializersMap()`
  Creates a `Map` with pairs of keys and `ArtifactSerializer`.
  `Map<String,String>`
  `createManifestEntries()`
  `abstract void`
  `validateArtifactMap()`
  Validates the parsed artifacts.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### BaseToolFactory

    public BaseToolFactory()
    All subclasses should have an empty constructor

- ## Method Details

  - ### createArtifactSerializersMap

    public Map<String,opennlp.tools.util.model.ArtifactSerializer<?>> createArtifactSerializersMap()
    Creates a `Map` with pairs of keys and `ArtifactSerializer`. The models implementation should call this method from `BaseModel#createArtifactSerializersMap`.

    The base implementation will return a `HashMap` that should be populated by subclasses.

  - ### createArtifactMap

    public Map<String,Object> createArtifactMap()
    A model's implementation should call this constructor that creates a model programmatically.

    The base implementation will return a `HashMap` that should be populated by subclasses.

    Returns:
      Retrieves a `Map` with pairs of keys and objects.

  - ### createManifestEntries

    public Map<String,String> createManifestEntries()
    Returns:
      Retrieves the manifest entries to be added to the model manifest.

  - ### validateArtifactMap

    public abstract void validateArtifactMap() throws opennlp.tools.util.InvalidFormatException
    Validates the parsed artifacts.

    Note: Subclasses should generally invoke `super.validateArtifactMap` at the beginning of this method.

    Throws:
      `opennlp.tools.util.InvalidFormatException` - Thrown if validation found invalid states.

  - ### create

    public static BaseToolFactory create(String subclassName, opennlp.tools.util.model.ArtifactProvider artifactProvider) throws opennlp.tools.util.InvalidFormatException
    Instantiates a `BaseToolFactory` via a given `subclassName`.
    Parameters:
      `subclassName` - The class name used for instantiation. The `ExtensionLoader` mechanism is applied to load the requested `subclassName`.
      `artifactProvider` - The `ArtifactProvider` to be used.
    Returns:
      A valid `BaseToolFactory` instance.
    Throws:
      `opennlp.tools.util.InvalidFormatException` - Thrown if the `ExtensionLoader` mechanism failed to create the factory associated with `subclassName`.

  - ### create

    public static BaseToolFactory create(Class<? extends BaseToolFactory> factoryClass, opennlp.tools.util.model.ArtifactProvider artifactProvider) throws opennlp.tools.util.InvalidFormatException
    Instantiates a `BaseToolFactory` via a given `subclassName`.
    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 `ArtifactProvider` to be used.
    Returns:
      A valid `BaseToolFactory` instance.
    Throws:
      `opennlp.tools.util.InvalidFormatException` - Thrown if the `ExtensionLoader` mechanism failed to create the factory associated with `subclassName`.