Package opennlp.tools.doccat

# Class EmojiFeatureGenerator

java.lang.Object
opennlp.tools.doccat.EmojiFeatureGenerator

All Implemented Interfaces:
  `opennlp.tools.doccat.FeatureGenerator`

public class EmojiFeatureGenerator extends Object implements opennlp.tools.doccat.FeatureGenerator
Generates document features from the emoji annotation layer: for every annotated token the project-authored coarse sentiment score (`emojiSentiment=2`), the entity type (`emojiType=HEART`), the document category hint (`emojiCategory=SMILEYS_AND_EMOTION`), and for flags the ISO 3166 region (`emojiRegion=DE`). Tokens that are not annotated symbols contribute nothing.

Strictly opt-in: pass it alongside the defaults, for example `new DoccatFactory(new FeatureGenerator[] {new BagOfWordsFeatureGenerator(), new EmojiFeatureGenerator()})`; the default factory configuration is unchanged. The no-argument constructor is required so a trained model can re-instantiate the generator from its manifest.

See Also:
  - `EmojiAnnotator`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `EmojiFeatureGenerator()`
  Instantiates a generator over the bundled and derived annotation layers.
  `EmojiFeatureGenerator(EmojiAnnotator annotator)`
  Instantiates a generator over a configured annotator, for example one with a gazetteer join.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Collection<String>`
  `extractFeatures(String[] text, Map<String,Object> extraInformation)`

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

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

- ## Constructor Details

  - ### EmojiFeatureGenerator

    public EmojiFeatureGenerator()
    Instantiates a generator over the bundled and derived annotation layers.

  - ### EmojiFeatureGenerator

    public EmojiFeatureGenerator(EmojiAnnotator annotator)
    Instantiates a generator over a configured annotator, for example one with a gazetteer join.
    Parameters:
      `annotator` - The annotator to use. Must not be `null`.
    Throws:
      `IllegalArgumentException` - if `annotator` is `null`.

- ## Method Details

  - ### extractFeatures

    public Collection<String> extractFeatures(String[] text, Map<String,Object> extraInformation)
    Specified by:
      `extractFeatures` in interface `opennlp.tools.doccat.FeatureGenerator`
    Throws:
      `IllegalArgumentException` - if `text` is `null`.