Search in sources :

Example 1 with InsufficientDataException

use of org.dkpro.statistics.agreement.InsufficientDataException in project webanno by webanno.

the class KrippendorffAlphaAgreementMeasure method calculatePairAgreement.

@Override
public CodingAgreementResult calculatePairAgreement(Map<String, List<CAS>> aCasMap) {
    AnnotationFeature feature = getFeature();
    KrippendorffAlphaAgreementTraits traits = getTraits();
    List<DiffAdapter> adapters = getDiffAdapters(annotationService, asList(feature.getLayer()));
    CasDiff diff = doDiff(adapters, traits.getLinkCompareBehavior(), aCasMap);
    CodingAgreementResult agreementResult = makeCodingStudy(diff, feature.getLayer().getName(), feature.getName(), traits.isExcludeIncomplete(), aCasMap);
    IAgreementMeasure agreement = new KrippendorffAlphaAgreement(agreementResult.getStudy(), new NominalDistanceFunction());
    if (agreementResult.getStudy().getItemCount() > 0) {
        try {
            agreementResult.setAgreement(agreement.calculateAgreement());
        } catch (InsufficientDataException e) {
            agreementResult.setAgreement(NaN);
        }
    } else {
        agreementResult.setAgreement(NaN);
    }
    return agreementResult;
}
Also used : CodingAgreementResult(de.tudarmstadt.ukp.clarin.webanno.agreement.results.coding.CodingAgreementResult) IAgreementMeasure(org.dkpro.statistics.agreement.IAgreementMeasure) CasDiff(de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff) KrippendorffAlphaAgreement(org.dkpro.statistics.agreement.coding.KrippendorffAlphaAgreement) InsufficientDataException(org.dkpro.statistics.agreement.InsufficientDataException) DiffAdapter(de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.api.DiffAdapter) NominalDistanceFunction(org.dkpro.statistics.agreement.distance.NominalDistanceFunction) AnnotationFeature(de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature)

Aggregations

CodingAgreementResult (de.tudarmstadt.ukp.clarin.webanno.agreement.results.coding.CodingAgreementResult)1 CasDiff (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff)1 DiffAdapter (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.api.DiffAdapter)1 AnnotationFeature (de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature)1 IAgreementMeasure (org.dkpro.statistics.agreement.IAgreementMeasure)1 InsufficientDataException (org.dkpro.statistics.agreement.InsufficientDataException)1 KrippendorffAlphaAgreement (org.dkpro.statistics.agreement.coding.KrippendorffAlphaAgreement)1 NominalDistanceFunction (org.dkpro.statistics.agreement.distance.NominalDistanceFunction)1