Search in sources :

Example 1 with PairwiseAnnotationResult

use of de.tudarmstadt.ukp.clarin.webanno.agreement.PairwiseAnnotationResult in project webanno by webanno.

the class KrippendorffAlphaUnitizingAgreementMeasure method getAgreement.

@Override
public PairwiseAnnotationResult<UnitizingAgreementResult> getAgreement(Map<String, List<CAS>> aCasMap) {
    PairwiseAnnotationResult<UnitizingAgreementResult> result = new PairwiseAnnotationResult<>(getFeature(), getTraits());
    List<Entry<String, List<CAS>>> entryList = new ArrayList<>(aCasMap.entrySet());
    for (int m = 0; m < entryList.size(); m++) {
        for (int n = 0; n < entryList.size(); n++) {
            // Triangle matrix mirrored
            if (n < m) {
                Map<String, List<CAS>> pairwiseCasMap = new LinkedHashMap<>();
                pairwiseCasMap.put(entryList.get(m).getKey(), entryList.get(m).getValue());
                pairwiseCasMap.put(entryList.get(n).getKey(), entryList.get(n).getValue());
                UnitizingAgreementResult res = calculatePairAgreement(pairwiseCasMap);
                result.add(entryList.get(m).getKey(), entryList.get(n).getKey(), res);
            }
        }
    }
    return result;
}
Also used : UnitizingAgreementResult(de.tudarmstadt.ukp.clarin.webanno.agreement.results.unitizing.UnitizingAgreementResult) PairwiseAnnotationResult(de.tudarmstadt.ukp.clarin.webanno.agreement.PairwiseAnnotationResult) Entry(java.util.Map.Entry) CAS(org.apache.uima.cas.CAS) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

PairwiseAnnotationResult (de.tudarmstadt.ukp.clarin.webanno.agreement.PairwiseAnnotationResult)1 UnitizingAgreementResult (de.tudarmstadt.ukp.clarin.webanno.agreement.results.unitizing.UnitizingAgreementResult)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Entry (java.util.Map.Entry)1 CAS (org.apache.uima.cas.CAS)1