Search in sources :

Example 26 with TextAnnotation

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;
}
Also used : KeywordAnnotation(org.opencastproject.metadata.mpeg7.KeywordAnnotation) TextAnnotation(org.opencastproject.metadata.mpeg7.TextAnnotation) FreeTextAnnotation(org.opencastproject.metadata.mpeg7.FreeTextAnnotation)

Aggregations

ArrayList (java.util.ArrayList)10 TextAnnotation (org.kie.workbench.common.dmn.api.definition.v1_1.TextAnnotation)9 FreeTextAnnotation (org.opencastproject.metadata.mpeg7.FreeTextAnnotation)7 TextAnnotation (org.opencastproject.metadata.mpeg7.TextAnnotation)7 List (java.util.List)6 View (org.kie.workbench.common.stunner.core.graph.content.view.View)6 KeywordAnnotation (org.opencastproject.metadata.mpeg7.KeywordAnnotation)4 Iterator (java.util.Iterator)3 Entry (java.util.Map.Entry)3 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)3 BoundaryEvent (org.eclipse.bpmn2.BoundaryEvent)3 DataObject (org.eclipse.bpmn2.DataObject)3 Process (org.eclipse.bpmn2.Process)3 SequenceFlow (org.eclipse.bpmn2.SequenceFlow)3 SubProcess (org.eclipse.bpmn2.SubProcess)3 TextAnnotation (org.kie.dmn.model.v1_1.TextAnnotation)3 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.v1_1.BusinessKnowledgeModel)3 Decision (org.kie.workbench.common.dmn.api.definition.v1_1.Decision)3 InputData (org.kie.workbench.common.dmn.api.definition.v1_1.InputData)3 KnowledgeSource (org.kie.workbench.common.dmn.api.definition.v1_1.KnowledgeSource)3