Search in sources :

Example 1 with AgreementResult

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

the class TwoPairedKappaTest method testTwoUserDiffSpanAnnotation.

@Test
public void testTwoUserDiffSpanAnnotation() throws Exception {
    Map<User, List<SourceDocument>> userDocs = new HashMap<>();
    userDocs.put(user1, asList(document));
    userDocs.put(user2, asList(document));
    Map<User, CAS> userCases = new HashMap<>();
    userCases.put(user1, kappatestCas);
    userCases.put(user2, kappaspandiff);
    Map<SourceDocument, Map<User, CAS>> documentJCases = new HashMap<>();
    documentJCases.put(document, userCases);
    // Check against new impl
    CasDiff diff = doDiff(asList(POS_DIFF_ADAPTER), LINK_TARGET_AS_LABEL, convert(userCases));
    DiffResult result = diff.toResult();
    AgreementResult agreement = getCohenKappaAgreement(diff, POS.class.getName(), "PosValue", convert(userCases));
    // Asserts
    System.out.printf("Agreement: %s%n", agreement.toString());
    result.print(System.out);
    assertEquals(0.86153d, agreement.getAgreement(), 0.00001d);
    assertEquals(9, result.size());
    assertEquals(1, result.getDifferingConfigurationSets().size());
    assertEquals(0, result.getIncompleteConfigurationSets().size());
}
Also used : AgreementResult(de.tudarmstadt.ukp.clarin.webanno.agreement.AgreementResult) CodingAgreementResult(de.tudarmstadt.ukp.clarin.webanno.agreement.results.coding.CodingAgreementResult) User(de.tudarmstadt.ukp.clarin.webanno.security.model.User) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) CasDiff(de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff) SourceDocument(de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument) CAS(org.apache.uima.cas.CAS) POS(de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.POS) Arrays.asList(java.util.Arrays.asList) List(java.util.List) DiffResult(de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.DiffResult) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) Test(org.junit.Test)

Example 2 with AgreementResult

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

the class TwoPairedKappaTest method testTwoUserDiffArcAnnotation.

@Test
public void testTwoUserDiffArcAnnotation() throws Exception {
    Map<User, List<SourceDocument>> userDocs = new HashMap<>();
    userDocs.put(user1, asList(document));
    userDocs.put(user2, asList(document));
    Map<User, CAS> userCases = new HashMap<>();
    userCases.put(user1, kappatestCas);
    userCases.put(user2, kappaarcdiff);
    Map<SourceDocument, Map<User, CAS>> documentJCases = new HashMap<>();
    documentJCases.put(document, userCases);
    // Check against new impl
    CasDiff diff = doDiff(asList(DEPENDENCY_DIFF_ADAPTER), LINK_TARGET_AS_LABEL, convert(userCases));
    DiffResult result = diff.toResult();
    AgreementResult agreement = getCohenKappaAgreement(diff, Dependency.class.getName(), "DependencyType", convert(userCases));
    // Asserts
    System.out.printf("Agreement: %s%n", agreement.toString());
    result.print(System.out);
    assertEquals(0.86153d, agreement.getAgreement(), 0.00001d);
    assertEquals(9, result.size());
    assertEquals(1, result.getDifferingConfigurationSets().size());
    assertEquals(0, result.getIncompleteConfigurationSets().size());
}
Also used : AgreementResult(de.tudarmstadt.ukp.clarin.webanno.agreement.AgreementResult) CodingAgreementResult(de.tudarmstadt.ukp.clarin.webanno.agreement.results.coding.CodingAgreementResult) User(de.tudarmstadt.ukp.clarin.webanno.security.model.User) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) CasDiff(de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff) SourceDocument(de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument) Dependency(de.tudarmstadt.ukp.dkpro.core.api.syntax.type.dependency.Dependency) CAS(org.apache.uima.cas.CAS) Arrays.asList(java.util.Arrays.asList) List(java.util.List) DiffResult(de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.DiffResult) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) Test(org.junit.Test)

Example 3 with AgreementResult

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

the class TwoPairedKappaTest method testTwoUserSameAnnotation.

@Test
public void testTwoUserSameAnnotation() throws Exception {
    Map<User, List<SourceDocument>> userDocs = new HashMap<>();
    userDocs.put(user1, asList(document));
    userDocs.put(user2, asList(document));
    Map<User, CAS> userCases = new HashMap<>();
    userCases.put(user1, kappatestCas);
    userCases.put(user2, kappatestCas);
    Map<SourceDocument, Map<User, CAS>> documentJCases = new HashMap<>();
    documentJCases.put(document, userCases);
    // Check against new impl
    CasDiff diff = doDiff(asList(POS_DIFF_ADAPTER), LINK_TARGET_AS_LABEL, convert(userCases));
    DiffResult result = diff.toResult();
    AgreementResult agreement = getCohenKappaAgreement(diff, POS.class.getName(), "PosValue", convert(userCases));
    // Asserts
    System.out.printf("Agreement: %s%n", agreement.toString());
    result.print(System.out);
    assertEquals(1.0d, agreement.getAgreement(), 0.000001);
    assertEquals(9, result.size());
    assertEquals(0, result.getDifferingConfigurationSets().size());
    assertEquals(0, result.getIncompleteConfigurationSets().size());
}
Also used : AgreementResult(de.tudarmstadt.ukp.clarin.webanno.agreement.AgreementResult) CodingAgreementResult(de.tudarmstadt.ukp.clarin.webanno.agreement.results.coding.CodingAgreementResult) User(de.tudarmstadt.ukp.clarin.webanno.security.model.User) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) CasDiff(de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff) SourceDocument(de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument) CAS(org.apache.uima.cas.CAS) POS(de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.POS) Arrays.asList(java.util.Arrays.asList) List(java.util.List) DiffResult(de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.DiffResult) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) Test(org.junit.Test)

Example 4 with AgreementResult

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

the class TwoPairedKappaTest method testThreeUserDiffArcAndSpanAnnotation.

@Test
public void testThreeUserDiffArcAndSpanAnnotation() throws Exception {
    Map<User, List<SourceDocument>> userDocs = new HashMap<>();
    userDocs.put(user1, asList(document));
    userDocs.put(user2, asList(document));
    userDocs.put(user3, asList(document));
    Map<User, CAS> userCases = new HashMap<>();
    userCases.put(user1, kappatestCas);
    userCases.put(user2, kappaspandiff);
    userCases.put(user3, kappaspanarcdiff);
    Map<SourceDocument, Map<User, CAS>> documentJCases = new HashMap<>();
    documentJCases.put(document, userCases);
    // Check against new impl
    CasDiff diff = doDiff(asList(POS_DIFF_ADAPTER, DEPENDENCY_DIFF_ADAPTER), LINK_TARGET_AS_LABEL, convert(userCases));
    DiffResult result = diff.toResult();
    Map<String, List<CAS>> user1and2 = convert(userCases);
    user1and2.remove("user3");
    AgreementResult agreement12 = getCohenKappaAgreement(diff, Dependency.class.getName(), "DependencyType", user1and2);
    Map<String, List<CAS>> user2and3 = convert(userCases);
    user2and3.remove("user1");
    AgreementResult agreement23 = getCohenKappaAgreement(diff, Dependency.class.getName(), "DependencyType", user2and3);
    Map<String, List<CAS>> user1and3 = convert(userCases);
    user1and3.remove("user2");
    AgreementResult agreement13 = getCohenKappaAgreement(diff, Dependency.class.getName(), "DependencyType", user1and3);
    // Asserts
    result.print(System.out);
    System.out.printf("New agreement 1/2: %s%n", agreement12.toString());
    System.out.printf("New agreement 2/3: %s%n", agreement23.toString());
    System.out.printf("New agreement 1/3: %s%n", agreement13.toString());
}
Also used : AgreementResult(de.tudarmstadt.ukp.clarin.webanno.agreement.AgreementResult) CodingAgreementResult(de.tudarmstadt.ukp.clarin.webanno.agreement.results.coding.CodingAgreementResult) User(de.tudarmstadt.ukp.clarin.webanno.security.model.User) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) CasDiff(de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff) SourceDocument(de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument) Dependency(de.tudarmstadt.ukp.dkpro.core.api.syntax.type.dependency.Dependency) CAS(org.apache.uima.cas.CAS) Arrays.asList(java.util.Arrays.asList) List(java.util.List) DiffResult(de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.DiffResult) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) Test(org.junit.Test)

Aggregations

AgreementResult (de.tudarmstadt.ukp.clarin.webanno.agreement.AgreementResult)4 CodingAgreementResult (de.tudarmstadt.ukp.clarin.webanno.agreement.results.coding.CodingAgreementResult)4 CasDiff (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff)4 DiffResult (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.DiffResult)4 SourceDocument (de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument)4 User (de.tudarmstadt.ukp.clarin.webanno.security.model.User)4 Arrays.asList (java.util.Arrays.asList)4 HashMap (java.util.HashMap)4 LinkedHashMap (java.util.LinkedHashMap)4 List (java.util.List)4 Map (java.util.Map)4 CAS (org.apache.uima.cas.CAS)4 Test (org.junit.Test)4 POS (de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.POS)2 Dependency (de.tudarmstadt.ukp.dkpro.core.api.syntax.type.dependency.Dependency)2