Map<String,Integer> urlCategoryCounts = new HashMap<String,Integer>();
for(SimpleTweet tweet : tweets) {
//System.err.println(tweet.getText());
TextwiseClassification textClassification = TextwiseClassifier.classify(tweet.getText(), false);
textClassification.print();
for(String category : textClassification.getCategories()) {
if(textCategoryScores.containsKey(category)) {
textCategoryScores.put(category, textCategoryScores.get(category) + textClassification.lookupScore(category));
textCategoryCounts.put(category, textCategoryCounts.get(category) + 1);
} else {
textCategoryScores.put(category, textClassification.lookupScore(category));
textCategoryCounts.put(category, 1);
}
}
for(String url : tweet.getUrls()) {
//System.err.println(url);
TextwiseClassification urlClassification = TextwiseClassifier.classify(url, true);
urlClassification.print();
for(String category : urlClassification.getCategories()) {
if(urlCategoryScores.containsKey(category)) {
urlCategoryScores.put(category, urlCategoryScores.get(category) + urlClassification.lookupScore(category));
urlCategoryCounts.put(category, urlCategoryCounts.get(category) + 1);
} else {
urlCategoryScores.put(category, urlClassification.lookupScore(category));
urlCategoryCounts.put(category, 1);
}
}
}