String text = Files.readFromFile( new File(classDir, testingFiles[j]) );
//*-- limit the length of the text
if (text.length() > 500) text = text.substring(0, 500);
logger.debug("Testing on " + CATEGORIES[i] + File.separator + testingFiles[j]);
JointClassification jc = compiledClassifier.classifyJoint(text);
//*-- check if we have sufficient confidence in the decision
String bestCategory = (jc.score(0) > -2.5) ? jc.bestCategory(): "text";
confMatrix.increment(CATEGORIES[i], bestCategory);
logger.debug("Best Category: " + bestCategory );
StringBuffer sb = new StringBuffer();
sb.append("Scores ");
for (int k = 0; k < CATEGORIES.length; k++)
sb.append(nf.format(jc.score(k)) + " ");
logger.debug(sb);
} //*-- end of inner for
} //*-- end of outer for
logger.info("--------------------------------------------");