package com.github.bot.curiosone.core.analysis;

import com.github.bot.curiosone.core.nlp.Phrase;

/**
 * Handles emotion analysis for a Phrase.
 * Provides a single public static method to perform to calculate the emotion of a given Phrase.
 */
public class EmotionAnalysis {

  /**
   * Private constructor.
   */
  private EmotionAnalysis() {}

  /**
   * Performs an emotion analysis of the provided Phrase.
   * @param phrase the Phrase to be analysed.
   * @return a String representation of the calculated emotion. Supports "sad", "happy" and "angry"
   */
  public static String getEmotion(Phrase phrase) {
    double score = TokenScorer.calculateScore(phrase.getTokens());
    if (score <= -0.5) {
      return "angry";
    }
    if (score < 0) {
      return "sad";
    }
    return "happy";
  }
}

@@ -107,16 +107,24 @@
 Handles 
+phrasal 
 emotion 
@@ -135,21 +135,8 @@
 ysis
- for a Phrase
 .%0A *
@@ -182,19 +182,8 @@
  to 
-perform to 
 calc
@@ -401,22 +401,36 @@
  @param 
+ 
 phrase
+%0A   *        
  the Phr
@@ -462,16 +462,17 @@
 @return 
+ 
 a String
@@ -550,16 +550,68 @@
 %22angry%22%0A
+   * @see  com.github.bot.curiosone.core.nlp.Phrase%0A
    */%0A  

improve EmotionAnalysis javadoc