Class api.SentimentAnalysisAPI
- java.lang.Object
-
- api.SentimentAnalysisAPI
-
public class api.SentimentAnalysisAPI extends java.lang.ObjectClass that contains the methods to connect with Sentiment Analysis api.SentimentAnalysisAPI
-
-
Constructor Summary
Constructors Constructor Description api.SentimentAnalysisAPI()
-
Method Summary
Modifier and Type Method Description java.lang.Stringemotion(java.lang.String text, java.lang.String tool, java.lang.String apiKey)Make a request to ML tool for sentiment analysis.java.lang.Stringtranslator(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.
-
-
-
Method Detail
-
emotion
public java.lang.String emotion(java.lang.String text, java.lang.String tool, java.lang.String apiKey) throws java.io.IOExceptionMake 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.ParseExceptionMake a request to translator api.SentimentAnalysisAPI to translate a block of text.- Parameters:
text- Text to translatetranslator- 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
-
-