Package opennlp.tools.namefind

# Class DefaultNameContextGenerator

java.lang.Object
opennlp.tools.namefind.DefaultNameContextGenerator

All Implemented Interfaces:
  `opennlp.tools.namefind.NameContextGenerator`, `opennlp.tools.util.BeamSearchContextGenerator<String>`

public class DefaultNameContextGenerator extends Object implements opennlp.tools.namefind.NameContextGenerator
A `NameContextGenerator` implementation for determining contextual features for a `tag-chunk` style named-entity recognizer.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultNameContextGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator... featureGenerators)`
  Creates a name context generator with the specified `feature generators`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addFeatureGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator generator)`
  `void`
  `clearAdaptiveData()`
  `String[]`
  `getContext(int index, String[] tokens, String[] preds, Object[] additionalContext)`
  Finds the context for finding names at the specified index.
  `void`
  `updateAdaptiveData(String[] tokens, String[] outcomes)`

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

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

- ## Constructor Details

  - ### DefaultNameContextGenerator

    public DefaultNameContextGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator... featureGenerators)
    Creates a name context generator with the specified `feature generators`.
    Parameters:
      `featureGenerators` - One or more `feature generators`.

- ## Method Details

  - ### addFeatureGenerator

    public void addFeatureGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator generator)
    Specified by:
      `addFeatureGenerator` in interface `opennlp.tools.namefind.NameContextGenerator`

  - ### updateAdaptiveData

    public void updateAdaptiveData(String[] tokens, String[] outcomes)
    Specified by:
      `updateAdaptiveData` in interface `opennlp.tools.namefind.NameContextGenerator`

  - ### clearAdaptiveData

    public void clearAdaptiveData()
    Specified by:
      `clearAdaptiveData` in interface `opennlp.tools.namefind.NameContextGenerator`

  - ### getContext

    public String[] getContext(int index, String[] tokens, String[] preds, Object[] additionalContext)
    Finds the context for finding names at the specified index.
    Specified by:
      `getContext` in interface `opennlp.tools.util.BeamSearchContextGenerator<String>`
    Parameters:
      `index` - The index of the token in the specified `tokens` for which the context should be constructed.
      `tokens` - The tokens of the sentence. The `toString()` methods of these objects should return the token text.
      `preds` - The previous decisions made in the tagging of this sequence. Only indices less than `index` will be examined.
      `additionalContext` - Addition features which may be based on a context outside the sentence.
    Returns:
      The context for finding names at the specified `index`.