Class api.SentimentAnalysisAPI


  • public class api.SentimentAnalysisAPI
    extends java.lang.Object
    Class that contains the methods to connect with Sentiment Analysis api.SentimentAnalysisAPI
    • Method Summary

      Modifier and Type Method Description
      java.lang.String emotion​(java.lang.String text, java.lang.String tool, java.lang.String apiKey)
      Make a request to ML tool for sentiment analysis.
      java.lang.String translator​(java.lang.String text, java.lang.String translator, java.lang.String from, java.lang.String to, java.lang.String apiKey)
      Make a request to translator api.SentimentAnalysisAPI to translate a block of text.
      • Methods inherited from class java.lang.Object

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

      • api.SentimentAnalysisAPI

        public api.API()
    • Method Detail

      • emotion

        public java.lang.String emotion​(java.lang.String text,
                                        java.lang.String tool,
                                        java.lang.String apiKey)
                                 throws java.io.IOException
        Make a request to ML tool for sentiment analysis.
        Parameters:
        text - Text to analyze.
        tool - Machine learning tool to do sentiment analysis.
        apiKey - Api key to authorize the machine learning tool.
        Returns:
        Returns a string that contains a json with each of six emotions weighted.
        Throws:
        java.io.IOException - caused by an error in the api.SentimentAnalysisAPI call.
      • translator

        public java.lang.String translator​(java.lang.String text,
                                           java.lang.String translator,
                                           java.lang.String from,
                                           java.lang.String to,
                                           java.lang.String apiKey)
                                    throws java.io.IOException,
                                           org.json.simple.parser.ParseException
        Make a request to translator api.SentimentAnalysisAPI to translate a block of text.
        Parameters:
        text - Text to translate
        translator - Translator api.SentimentAnalysisAPI to translate the text.
        from - Source language code.
        to - Target language code.
        apiKey - Api-key to authorize translator api.SentimentAnalysisAPI.
        Returns:
        Returns a string that contains a json with text translated and source and target language codes.
        Throws:
        java.io.IOException - caused by an error during the execution of the http request.
        org.json.simple.parser.ParseException - ParseException