/** * Note the tweets with the chosen method * * @param listeTweets : list of tweets * @param algo : choice of the ranking method * @throws IOException */ public void rateTweets(List<Tweet> listeTweets, String algo) throws IOException { for (Tweet tweet : listCleanTweets) { String text = tweet.getTweet(); int mark = 0; switch (algo) { case "Keyword": mark = KeywordMethod.getClassePosNeg(text); break; case "Knn": mark = KnnMethod.knn(text, 30, baseTweets); break; case "BayesUniPres": mark = BayesMethod.rankBayes(listCleanTweets, text, 0); break; case "BayesUniFreq": mark = BayesMethod.rankBayes(listCleanTweets, text, 1); break; case "BayesBigPres": mark = BayesBiGrammeMethod.rankBigramBayes(listCleanTweets, text, 1); break; case "BayesBigFreq": mark = BayesBiGrammeMethod.rankBigramBayes(listCleanTweets, text, 0); break; } tweet.setNote(mark); } }