Package opennlp.tools.sentiment

# Class SentimentContextGenerator

java.lang.Object
opennlp.tools.sentiment.SentimentContextGenerator

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

Direct Known Subclasses:
  `EmojiSentimentContextGenerator`

public class SentimentContextGenerator extends Object implements opennlp.tools.util.BeamSearchContextGenerator<String>
Class for using a Context Generator for Sentiment Analysis.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SentimentContextGenerator()`
  `SentimentContextGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator[] featureGenerators)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String[]`
  `getContext(int index, String[] sequence, String[] priorDecisions, Object[] additionalContext)`
  Returns the context.
  `String[]`
  `getContext(String[] text)`
  Returns the context
  `void`
  `updateAdaptiveData(String[] tokens, String[] outcomes)`

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

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

- ## Constructor Details

  - ### SentimentContextGenerator

    public SentimentContextGenerator()

  - ### SentimentContextGenerator

    public SentimentContextGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator[] featureGenerators)

- ## Method Details

  - ### getContext

    public String[] getContext(String[] text)
    Returns the context
    Parameters:
      `text` - the given text to be returned as context
    Returns:
      the text (the context)

  - ### getContext

    public String[] getContext(int index, String[] sequence, String[] priorDecisions, Object[] additionalContext)
    Returns the context.
    Specified by:
      `getContext` in interface `opennlp.tools.util.BeamSearchContextGenerator<String>`
    Parameters:
      `index` - the index of the context
      `sequence` - String sequence given
      `priorDecisions` - decisions given earlier
      `additionalContext` - any additional context
    Returns:
      the context

  - ### updateAdaptiveData

    public void updateAdaptiveData(String[] tokens, String[] outcomes)