/* */ public void addCase( Tagging<E> referenceTagging, Iterator<ScoredTagging<E>> responseTaggingIterator) /* */ { /* 164 */ this.mNumCases += 1; /* 165 */ this.mNumTokens += referenceTagging.size(); /* 166 */ this.mLastCase = referenceTagging; /* 167 */ List expectedTags = referenceTagging.tags(); /* 168 */ for (int i = 0; (i < this.mMaxNBest) && (responseTaggingIterator.hasNext()); i++) { /* 169 */ Tagging tagging = (Tagging) responseTaggingIterator.next(); /* 170 */ if (expectedTags.equals(tagging.tags())) { /* 171 */ this.mNBestHistogram.increment(Integer.valueOf(i)); /* 172 */ this.mLastCaseRank = i; /* 173 */ return; /* */ } /* */ } /* 176 */ this.mLastCaseRank = -1; /* 177 */ this.mNBestHistogram.increment(Integer.valueOf(-1)); /* */ }
/** * Set all tags of this item. Discards all previous existing tags. Duplicates will not be added. * Trims all tags. * * @param tags the new tags as a string, tags are comma separated */ public void setTags(String tags) { final String[] sa = Tagging.splitAndTrim(tags); final StringBuffer sb = new StringBuffer(); for (int i = 0; i < sa.length; i++) { sb.append(sa[i]).append(','); } if (sa.length > 0) { sb.deleteCharAt(sb.length() - 1); } setMeta(META_TAGS, sb.toString()); }
/* */ public void handle(Tagging<E> referenceTagging) /* */ { /* 148 */ this.mLastCase = referenceTagging; /* 149 */ Iterator it = this.mTagger.tagNBest(referenceTagging.tokens(), this.mMaxNBest); /* */ /* 151 */ addCase(referenceTagging, it); /* */ }