Class SentimentContextGenerator

java.lang.Object
opennlp.tools.sentiment.SentimentContextGenerator
All Implemented Interfaces:
opennlp.tools.util.BeamSearchContextGenerator<String>

public class SentimentContextGenerator extends Object implements opennlp.tools.util.BeamSearchContextGenerator<String>
Class for using a Context Generator for Sentiment Analysis.
  • 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)