public String toString() { StringBuilder sb = new StringBuilder(getClass().getName()); if (stringPattern != null) { sb.append(" with string pattern=" + stringPattern.pattern()); } else { sb.append(" with token pattern=" + tokenPattern.pattern()); } return sb.toString(); }
protected String historyToString(List history) { String str = (String) historyToString.get(history); if (str == null) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < history.size(); i++) { sb.append('^'); sb.append(history.get(i)); } str = sb.toString(); historyToString.put(history, str); } return str; }
public String project(String tagStr) { StringBuilder sb = new StringBuilder(); boolean good = true; for (int pos = 0, len = tagStr.length(); pos < len; pos++) { char c = tagStr.charAt(pos); if (c == '-') { good = true; } else if (c == '^') { good = false; } if (good) { sb.append(c); } } String ret = sb.toString(); // System.err.println("TTP mapped " + tagStr + " to " + ret); return ret; }
protected String projectString(String str) { if (str.indexOf('@') == -1) { if (str.indexOf('^') == -1) { return str; } return str.substring(0, str.indexOf('^')); } StringBuilder sb = new StringBuilder(); sb.append(str.substring(0, str.indexOf(' '))); if (str.indexOf('^') > -1) { // sb.append(str.substring(str.indexOf('^'),str.length())); } int num = -2; for (int i = 0; i < str.length(); i++) { if (str.charAt(i) == ' ') { num++; } } sb.append(" w " + num); return sb.toString(); }
/** * Return a String that gives detailed human-readable information about how much time was spent by * each annotator and by the entire annotation pipeline. This String includes newline characters * but does not end with one, and so it is suitable to be printed out with a {@code println()}. * * @return Human readable information on time spent in processing. */ public String timingInformation() { StringBuilder sb = new StringBuilder(); if (TIME) { sb.append("Annotation pipeline timing information:\n"); Iterator<MutableLong> it = accumulatedTime.iterator(); long total = 0; for (Annotator annotator : annotators) { MutableLong m = it.next(); sb.append(StringUtils.getShortClassName(annotator)).append(": "); sb.append(Timing.toSecondsString(m.longValue())).append(" sec.\n"); total += m.longValue(); } sb.append("TOTAL: ").append(Timing.toSecondsString(total)).append(" sec."); } return sb.toString(); }