Search in sources :

Example 16 with CodingAgreementResult

use of de.tudarmstadt.ukp.clarin.webanno.agreement.results.coding.CodingAgreementResult in project webanno by webanno.

the class FleissKappaAgreementMeasure method calculatePairAgreement.

@Override
public CodingAgreementResult calculatePairAgreement(Map<String, List<CAS>> aCasMap) {
    AnnotationFeature feature = getFeature();
    DefaultAgreementTraits 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(), true, aCasMap);
    IAgreementMeasure agreement = new FleissKappaAgreement(agreementResult.getStudy());
    if (agreementResult.getStudy().getItemCount() > 0) {
        agreementResult.setAgreement(agreement.calculateAgreement());
    } else {
        agreementResult.setAgreement(Double.NaN);
    }
    return agreementResult;
}
Also used : CodingAgreementResult(de.tudarmstadt.ukp.clarin.webanno.agreement.results.coding.CodingAgreementResult) IAgreementMeasure(org.dkpro.statistics.agreement.IAgreementMeasure) FleissKappaAgreement(org.dkpro.statistics.agreement.coding.FleissKappaAgreement) CasDiff(de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff) DefaultAgreementTraits(de.tudarmstadt.ukp.clarin.webanno.agreement.measures.DefaultAgreementTraits) DiffAdapter(de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.api.DiffAdapter) AnnotationFeature(de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature)

Example 17 with CodingAgreementResult

use of de.tudarmstadt.ukp.clarin.webanno.agreement.results.coding.CodingAgreementResult 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)17 Test (org.junit.Test)13 DiffResult (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.DiffResult)7 CasDiff (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff)5 ICodingAnnotationItem (org.dkpro.statistics.agreement.coding.ICodingAnnotationItem)4 DiffAdapter (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.api.DiffAdapter)3 AnnotationFeature (de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature)3 IAgreementMeasure (org.dkpro.statistics.agreement.IAgreementMeasure)3 DefaultAgreementTraits (de.tudarmstadt.ukp.clarin.webanno.agreement.measures.DefaultAgreementTraits)2 Arrays.asList (java.util.Arrays.asList)2 List (java.util.List)2 Map (java.util.Map)2 CAS (org.apache.uima.cas.CAS)2 WebAnnoCasUtil.getFeature (de.tudarmstadt.ukp.clarin.webanno.api.annotation.util.WebAnnoCasUtil.getFeature)1 Configuration (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.Configuration)1 ConfigurationSet (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.ConfigurationSet)1 LinkCompareBehavior (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.LinkCompareBehavior)1 Position (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.api.Position)1 RelationDiffAdapter (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.relation.RelationDiffAdapter)1 RelationPosition (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.relation.RelationPosition)1