List of usage examples for edu.stanford.nlp.util StringUtils padLeft
public static String padLeft(double d, int totalChars)
From source file:lv.lumii.ner.analysis.ConfusionMatrix.java
License:Open Source License
public String summarize() { StringBuilder returnString = new StringBuilder(); returnString.append("Confusion Matrix\n"); returnString.append("----------------").append('\n'); for (String correctLabel : this.labels) { returnString/*from www .j a va 2 s . c om*/ .append(StringUtils .padLeft((correctLabel.length() > 3) ? correctLabel.substring(0, 4) : correctLabel, 5)) .append(' '); } returnString.append("<--Classified as").append('\n'); for (String correctLabel : this.labels) { int labelTotal = 0; for (String classifiedLabel : this.labels) { returnString .append(StringUtils.padLeft(Integer.toString(getCount(correctLabel, classifiedLabel)), 5)) .append(' '); labelTotal += getCount(correctLabel, classifiedLabel); } returnString.append(" | ").append(String.valueOf(labelTotal)).append('\t').append(correctLabel) .append('\n'); } returnString.append('\n'); return returnString.toString(); }