Class EmotionController


  • @RestController
    @RequestMapping("/api")
    public class EmotionController
    extends java.lang.Object
    Controller for /emotion endpoint in sentiment analysis API.
    Author:
    Ariadna de Arriba
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  EmotionController.Tools
      Available Machine Learning tools.
    • Method Summary

      Modifier and Type Method Description
      org.springframework.http.ResponseEntity<java.lang.String> getEmotion​(TextToAnalyze text, java.lang.String token, EmotionController.Tools tool)
      POST - Find the emotion in a block of text.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EmotionController

        public EmotionController()
    • Method Detail

      • getEmotion

        @PostMapping(value="/emotion",
                     produces="application/json")
        public org.springframework.http.ResponseEntity<java.lang.String> getEmotion​(@RequestBody
                                                                                    TextToAnalyze text,
                                                                                    @RequestHeader(name="Authorization",required=true)
                                                                                    java.lang.String token,
                                                                                    @RequestParam
                                                                                    EmotionController.Tools tool)
                                                                             throws java.io.IOException,
                                                                                    org.json.simple.parser.ParseException
        POST - Find the emotion in a block of text.
        Parameters:
        text - Text to analyze.
        token - Bearer token for authorization.
        tool - Machine learning tool for sentiment analysis.
        Returns:
        Returns a ResponseEntity that contains the result of calling this POST method.
        Throws:
        java.io.IOException - caused
        org.json.simple.parser.ParseException - ParseException caused by parsing the json.