Class twitter.Data
- java.lang.Object
-
- twitter.Data
-
public class twitter.Data extends java.lang.ObjectClass to manipulate data such as write a csv file containing a collection of tweets to train a model or wirte a csv file with the result of sentiment analysis.
-
-
Constructor Summary
Constructors Constructor Description twitter.Data()Constructor - initializes the api and properties.
-
Method Summary
Modifier and Type Method Description voidpredictEmotionFromCsv()Reads a csv file containing a text and a machine learning tool, and does sentiment analysis.voidpredictEmotionFromKafka(java.lang.String tweet)Applies sentiment analysis into a tweet read it from Kafka server.voidwriteCsv(java.lang.String tweet)Writes a tweet into csv file to collect a group of tweets and apply sentiment analysis with the objective of making a csv containing all the tweets to train a model.
-
-
-
Method Detail
-
predictEmotionFromCsv
public void predictEmotionFromCsv()
Reads a csv file containing a text and a machine learning tool, and does sentiment analysis. The result is an other csv file containing the text and a json string with the result of the emotions weighted.
-
predictEmotionFromKafka
public void predictEmotionFromKafka(java.lang.String tweet) throws java.io.IOException, org.json.simple.parser.ParseExceptionApplies sentiment analysis into a tweet read it from Kafka server. The result at the end of execution is a csv file containing the text of all tweets and a json string for each one with six emotions weighted (sentiment analysis result).- Parameters:
tweet- Tweet to apply sentiment analysis.- Throws:
java.io.IOException-caused by an error during the call to apply sentiment analysis or translate the text.org.json.simple.parser.ParseException-caused by an error during the call to apply sentiment analysis or translate the text.
-
writeCsv
public void writeCsv(java.lang.String tweet) throws java.io.IOException, org.json.simple.parser.ParseExceptionWrites a tweet into csv file to collect a group of tweets and apply sentiment analysis with the objective of making a csv containing all the tweets to train a model.- Parameters:
tweet- Tweet to write into csv file and translate if necessary.- Throws:
java.io.IOException-caused by an error during the call to translate the text.org.json.simple.parser.ParseException-caused by an error during the call to translate the text.
-
-