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;
}
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;
}
Aggregations