Class SentimentAnalyzer

java.lang.Object
org.episteme.social.linguistics.SentimentAnalyzer

public final class SentimentAnalyzer extends Object
Analytical tool for sentiment analysis and emotional polarity detection in text. It identifies positive, negative, and neutral tones using a lexicon-based approach with support for negations and intensifiers.
  • Method Details

    • analyze

      public static SentimentAnalyzer.SentimentResult analyze(String text)
      Performs sentiment analysis on a raw text string.
      Parameters:
      text - the input text to analyze
      Returns:
      a SentimentResult containing the polarity score and classification
    • analyzeWithAspects

      public static Map<String, SentimentAnalyzer.SentimentResult> analyzeWithAspects(String text, List<String> aspects)
      Performs aspect-based sentiment analysis by targeting specific keywords.
      Parameters:
      text - full text input
      aspects - list of keywords (aspects) to analyze separately
      Returns:
      map of aspects to their corresponding SentimentResult
    • sentimentDifference

      public static Real sentimentDifference(String text1, String text2)
      Calculates the numerical sentiment difference between two texts.
      Parameters:
      text1 - first text
      text2 - second text
      Returns:
      the difference in sentiment score (text1 - text2)