use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.DiffResult in project webanno by webanno.
the class CasDiffTest method someDifferencesTest.
@Test
public void someDifferencesTest() throws Exception {
Map<String, List<CAS>> casByUser = load("casdiff/someDifferences/user1.conll", "casdiff/someDifferences/user2.conll");
List<SpanDiffAdapter> diffAdapters = asList(POS_DIFF_ADAPTER);
CasDiff diff = doDiff(diffAdapters, LINK_TARGET_AS_LABEL, casByUser);
DiffResult result = diff.toResult();
// result.print(System.out);
assertEquals(26, result.size());
assertEquals(4, result.getDifferingConfigurationSets().size());
assertEquals(0, result.getIncompleteConfigurationSets().size());
// Todo: Agreement has moved to separate project - should create agreement test there
// CodingAgreementResult agreement = getCohenKappaAgreement(diff, entryTypes.get(0),
// "PosValue", casByUser);
// assertEquals(0.836477987d, agreement.getAgreement(), 0.000001d);
// assertEquals(0, agreement.getIncompleteSetsByPosition().size());
}
use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.DiffResult in project webanno by webanno.
the class CasDiffTest method relationLabelTest.
@Test
public void relationLabelTest() throws Exception {
Map<String, List<CAS>> casByUser = new HashMap<>();
casByUser.put("user1", asList(loadWebAnnoTsv3("testsuite/" + testContext.getMethodName() + "/user1.tsv").getCas()));
casByUser.put("user2", asList(loadWebAnnoTsv3("testsuite/" + testContext.getMethodName() + "/user2.tsv").getCas()));
List<? extends DiffAdapter> diffAdapters = asList(new RelationDiffAdapter(Dependency.class.getName(), "Dependent", "Governor", "DependencyType"));
CasDiff diff = doDiff(diffAdapters, LINK_TARGET_AS_LABEL, casByUser);
DiffResult result = diff.toResult();
// result.print(System.out);
assertEquals(26, result.size());
assertEquals(1, result.getDifferingConfigurationSets().size());
assertEquals(0, result.getIncompleteConfigurationSets().size());
// Todo: Agreement has moved to separate project - should create agreement test there
// CodingAgreementResult agreement = getCohenKappaAgreement(diff, entryTypes.get(0),
// "DependencyType", casByUser);
// assertEquals(0.958199d, agreement.getAgreement(), 0.000001d);
// assertEquals(0, agreement.getIncompleteSetsByPosition().size());
}
use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.DiffResult in project webanno by webanno.
the class CasDiffTest method multiLinkWithRoleNoDifferenceTest.
@Test
public void multiLinkWithRoleNoDifferenceTest() throws Exception {
JCas jcasA = createJCas(createMultiLinkWithRoleTestTypeSystem());
makeLinkHostFS(jcasA, 0, 0, makeLinkFS(jcasA, "slot1", 0, 0));
makeLinkHostFS(jcasA, 10, 10, makeLinkFS(jcasA, "slot1", 10, 10));
JCas jcasB = createJCas(createMultiLinkWithRoleTestTypeSystem());
makeLinkHostFS(jcasB, 0, 0, makeLinkFS(jcasB, "slot1", 0, 0));
makeLinkHostFS(jcasB, 10, 10, makeLinkFS(jcasB, "slot1", 10, 10));
Map<String, List<CAS>> casByUser = new LinkedHashMap<>();
casByUser.put("user1", asList(jcasA.getCas()));
casByUser.put("user2", asList(jcasB.getCas()));
SpanDiffAdapter adapter = new SpanDiffAdapter(HOST_TYPE);
adapter.addLinkFeature("links", "role", "target");
List<? extends DiffAdapter> diffAdapters = asList(adapter);
CasDiff diff = doDiff(diffAdapters, LINK_TARGET_AS_LABEL, casByUser);
DiffResult result = diff.toResult();
// result.print(System.out);
assertEquals(4, result.size());
assertEquals(0, result.getDifferingConfigurationSets().size());
assertEquals(0, result.getIncompleteConfigurationSets().size());
// Todo: Agreement has moved to separate project - should create agreement test there
// CodingAgreementResult agreement = getCohenKappaAgreement(diff, HOST_TYPE, "links",
// casByUser);
//
// // Asserts
// System.out.printf("Agreement: %s%n", agreement.toString());
// AgreementUtils.dumpAgreementStudy(System.out, agreement);
//
// assertEquals(1.0d, agreement.getAgreement(), 0.00001d);
}
use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.DiffResult in project webanno by webanno.
the class CasDiffTest method multiLinkWithRoleLabelDifferenceTest2.
@Test
public void multiLinkWithRoleLabelDifferenceTest2() throws Exception {
JCas jcasA = createJCas(createMultiLinkWithRoleTestTypeSystem());
makeLinkHostFS(jcasA, 0, 0, makeLinkFS(jcasA, "slot1", 0, 0));
JCas jcasB = createJCas(createMultiLinkWithRoleTestTypeSystem());
makeLinkHostFS(jcasB, 0, 0, makeLinkFS(jcasB, "slot2", 0, 0));
Map<String, List<CAS>> casByUser = new LinkedHashMap<>();
casByUser.put("user1", asList(jcasA.getCas()));
casByUser.put("user2", asList(jcasB.getCas()));
SpanDiffAdapter adapter = new SpanDiffAdapter(HOST_TYPE);
adapter.addLinkFeature("links", "role", "target");
List<? extends DiffAdapter> diffAdapters = asList(adapter);
CasDiff diff = doDiff(diffAdapters, LINK_ROLE_AS_LABEL, casByUser);
DiffResult result = diff.toResult();
// result.print(System.out);
assertEquals(2, result.size());
assertEquals(1, result.getDifferingConfigurationSets().size());
assertEquals(0, result.getIncompleteConfigurationSets().size());
// Todo: Agreement has moved to separate project - should create agreement test there
// CodingAgreementResult agreement = AgreementUtils.getCohenKappaAgreement(diff, HOST_TYPE,
// "links", casByUser);
//
// // Asserts
// System.out.printf("Agreement: %s%n", agreement.toString());
// AgreementUtils.dumpAgreementStudy(System.out, agreement);
//
// assertEquals(0.0d, agreement.getAgreement(), 0.00001d);
}
use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.DiffResult in project webanno by webanno.
the class CasDiffTest method relationDistanceTest.
@Test
public void relationDistanceTest() throws Exception {
Map<String, List<CAS>> casByUser = load("casdiff/relationDistance/user1.conll", "casdiff/relationDistance/user2.conll");
List<? extends DiffAdapter> diffAdapters = asList(new RelationDiffAdapter(Dependency.class.getName(), "Dependent", "Governor", "DependencyType"));
CasDiff diff = doDiff(diffAdapters, LINK_TARGET_AS_LABEL, casByUser);
DiffResult result = diff.toResult();
// result.print(System.out);
assertEquals(27, result.size());
assertEquals(0, result.getDifferingConfigurationSets().size());
assertEquals(2, result.getIncompleteConfigurationSets().size());
// Todo: Agreement has moved to separate project - should create agreement test there
// CodingAgreementResult agreement = getCohenKappaAgreement(diff, entryTypes.get(0),
// "DependencyType", casByUser);
// assertEquals(1.0, agreement.getAgreement(), 0.000001d);
// assertEquals(2, agreement.getIncompleteSetsByPosition().size());
}
Aggregations