//tokenSet.remove(stemmer.getStem(s));
tokenSet.add("PROTECT:" + s);
tokenSet.add("PROTECT:stem=" + stemmer.getStem(s));
}
if(hasPotentialReact) {
Event e = new Event(hasReact ? "TRUE" : "FALSE", tokenSet.toArray(new String[0]));
events.add(e);
BagEvent be = new BagEvent(hasReact ? "TRUE" : "FALSE", tokenBag);
eventBags.add(be);
}
}
if(false) {
ClassificationEvaluator ce = new ClassificationEvaluator();
MultinomialNaiveBayes mnb = new MultinomialNaiveBayes(eventBags);
for(int i=0;i<eventBags.size();i++) {
BagEvent be = eventBags.get(i);
//for(BagEvent be : eventBags) {
Map<String,Double> results = mnb.testBag(be.getClassLabel(), be.getFeatures());
System.out.println(be.getClassLabel() + "\t" + mnb.testBag(be.getFeatures()));
ce.logEvent(be.getClassLabel(), mnb.bestResult(results));
String rf = "MNB:" + mnb.bestResult(results);
Event e = events.get(i);
String [] sa = new String[e.getContext().length + 1];
for(int j=0;j<e.getContext().length;j++) {
sa[j] = e.getContext()[j];
}
sa[e.getContext().length] = rf;
events.set(i, new Event(e.getOutcome(), sa));
}
System.out.println(ce.getAccuracy());
System.out.println(ce.getKappa());
ce.pprintConfusionMatrix();
ce.pprintPrecisionRecallEval();