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

Package opennlp.tools.util.featuregen

# Class POSTaggerNameFeatureGenerator

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

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

@ThreadSafe public class POSTaggerNameFeatureGenerator extends Object implements opennlp.tools.util.featuregen.AdaptiveFeatureGenerator
Adds the token POS tag as feature. Requires a `POSTagger` at runtime.

The "is this still the same sentence?" cache (a `String[]` of POS tags reused across the tokens of one sentence) is held per-thread via `ThreadLocal`, so a single instance is safe to share across multiple threads — for example when the enclosing `NameFinderME` is shared. Cache identity uses `Arrays.equals(Object[], Object[])` (content equality), preserving the original single-threaded semantics.

See Also:
  - `AdaptiveFeatureGenerator`
  - `POSTagger`
  - `POSModel`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `POSTaggerNameFeatureGenerator(POSModel aPosModel)`
  Initializes a `POSTaggerNameFeatureGenerator` with the specified `POSModel`.
  `POSTaggerNameFeatureGenerator(opennlp.tools.postag.POSTagger aPosTagger)`
  Initializes a `POSTaggerNameFeatureGenerator` with the specified `POSTagger`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `createFeatures(List<String> feats, String[] toks, int index, String[] preds)`

  ### 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

  - ### POSTaggerNameFeatureGenerator

    public POSTaggerNameFeatureGenerator(opennlp.tools.postag.POSTagger aPosTagger)
    Initializes a `POSTaggerNameFeatureGenerator` with the specified `POSTagger`.
    Parameters:
      `aPosTagger` - A POSTagger instance to be used.

  - ### POSTaggerNameFeatureGenerator

    public POSTaggerNameFeatureGenerator(POSModel aPosModel)
    Initializes a `POSTaggerNameFeatureGenerator` with the specified `POSModel`.
    Parameters:
      `aPosModel` - A `POSModel` to be used for the internal `POSTagger`.

- ## Method Details

  - ### createFeatures

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