BagOfWordsFeatureGenerator (Apache OpenNLP Tools 2.5.9 API)
Description: declaration: package: opennlp.tools.doccat, class: BagOfWordsFeatureGenerator

# Class BagOfWordsFeatureGenerator

java.lang.Object
opennlp.tools.doccat.BagOfWordsFeatureGenerator

All Implemented Interfaces:
  `FeatureGenerator`

public class BagOfWordsFeatureGenerator extends Object implements FeatureGenerator
Generates a feature for each word in a document.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BagOfWordsFeatureGenerator()`
  Instantiates a default `BagOfWordsFeatureGenerator` instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Collection<String>`
  `extractFeatures(String[] text, Map<String,Object> extraInformation)`
  Extracts features from given `text` fragments.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### BagOfWordsFeatureGenerator

    public BagOfWordsFeatureGenerator()
    Instantiates a default `BagOfWordsFeatureGenerator` instance.

- ## Method Details

  - ### extractFeatures

    public Collection<String> extractFeatures(String[] text, Map<String,Object> extraInformation)
    Description copied from interface: `FeatureGenerator`
    Extracts features from given `text` fragments.
    Specified by:
      `extractFeatures` in interface `FeatureGenerator`
    Parameters:
      `text` - The text fragments to extract features from
      `extraInformation` - Optional extra information to be used by the `FeatureGenerator`.
    Returns:
      A collection of features.