use of org.eclipse.bpmn2.TextAnnotation in project opencast by opencast.
the class SolrIndexManager method getMaxConfidence.
/**
* Gets the maximum confidence for a given keyword in the text annotation.
*
* @param keyword
* @param sortedAnnotations
* @return The maximum confidence value.
*/
static double getMaxConfidence(String keyword, SortedSet<TextAnnotation> sortedAnnotations) {
double max = 0.0;
String needle = null;
TextAnnotation textAnnotation = null;
Iterator<TextAnnotation> textAnnotations = sortedAnnotations.iterator();
while (textAnnotations.hasNext()) {
textAnnotation = textAnnotations.next();
Iterator<KeywordAnnotation> keywordAnnotations = textAnnotation.keywordAnnotations();
while (keywordAnnotations.hasNext()) {
KeywordAnnotation ann = keywordAnnotations.next();
needle = ann.getKeyword().toLowerCase();
if (keyword.equals(needle)) {
if (max < textAnnotation.getConfidence()) {
max = textAnnotation.getConfidence();
}
}
}
}
return max;
}
Aggregations