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

Package opennlp.tools.util.featuregen

# Class AdditionalContextFeatureGenerator

java.lang.Object
opennlp.tools.util.featuregen.AdditionalContextFeatureGenerator

All Implemented Interfaces:
  `opennlp.tools.util.featuregen.AdaptiveFeatureGenerator`

@ThreadSafe public class AdditionalContextFeatureGenerator extends Object implements opennlp.tools.util.featuregen.AdaptiveFeatureGenerator
The `AdditionalContextFeatureGenerator` generates the context from the passed in additional context.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AdditionalContextFeatureGenerator()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clearForCurrentThread()`
  Releases the calling thread's per-thread context slot.
  `void`
  `createFeatures(List<String> features, String[] tokens, int index, String[] preds)`
  `void`
  `setCurrentContext(String[][] context)`

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

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

  ### Methods inherited from interface opennlp.tools.util.featuregen.AdaptiveFeatureGenerator

  `clearAdaptiveData, updateAdaptiveData`

- ## Constructor Details

  - ### AdditionalContextFeatureGenerator

    public AdditionalContextFeatureGenerator()

- ## Method Details

  - ### createFeatures

    public void createFeatures(List<String> features, String[] tokens, int index, String[] preds)
    Specified by:
      `createFeatures` in interface `opennlp.tools.util.featuregen.AdaptiveFeatureGenerator`

  - ### setCurrentContext

    public void setCurrentContext(String[][] context)

  - ### clearForCurrentThread

    public void clearForCurrentThread()
    Releases the calling thread's per-thread context slot. Call when a worker thread is being returned to a pool, or when the enclosing component is being disposed in a container with classloader isolation, to avoid pinning the thread's context classloader via the `ThreadLocal` entry.

    Same lifecycle contract as the `clearThreadLocalState()` methods on the ME classes that embed this generator (currently `NameFinderME`).