use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.SpanDiffAdapter in project webanno by webanno.
the class CasDiff2Test method multiLinkWithRoleMultiTargetDifferenceTest.
@Test
public void multiLinkWithRoleMultiTargetDifferenceTest() throws Exception {
JCas jcasA = JCasFactory.createJCas(DiffUtils.createMultiLinkWithRoleTestTypeSytem());
DiffUtils.makeLinkHostFS(jcasA, 0, 0, DiffUtils.makeLinkFS(jcasA, "slot1", 0, 0), DiffUtils.makeLinkFS(jcasA, "slot1", 10, 10));
JCas jcasB = JCasFactory.createJCas(DiffUtils.createMultiLinkWithRoleTestTypeSytem());
DiffUtils.makeLinkHostFS(jcasB, 0, 0, DiffUtils.makeLinkFS(jcasB, "slot1", 10, 10));
Map<String, List<JCas>> casByUser = new LinkedHashMap<>();
casByUser.put("user1", asList(jcasA));
casByUser.put("user2", asList(jcasB));
List<String> entryTypes = asList(DiffUtils.HOST_TYPE);
SpanDiffAdapter adapter = new SpanDiffAdapter(DiffUtils.HOST_TYPE);
adapter.addLinkFeature("links", "role", "target");
List<? extends DiffAdapter> diffAdapters = asList(adapter);
DiffResult diff = CasDiff2.doDiff(entryTypes, diffAdapters, LinkCompareBehavior.LINK_TARGET_AS_LABEL, casByUser);
diff.print(System.out);
assertEquals(2, diff.size());
assertEquals(1, diff.getDifferingConfigurationSets().size());
assertEquals(0, diff.getIncompleteConfigurationSets().size());
// // Check against new impl
// AgreementResult agreement = AgreementUtils.getCohenKappaAgreement(diff, HOST_TYPE, "links",
// casByUser);
//
// // Asserts
// System.out.printf("Agreement: %s%n", agreement.toString());
// AgreementUtils.dumpAgreementStudy(System.out, agreement);
//
// assertEquals(0.0, agreement.getAgreement(), 0.00001d);
}
use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.SpanDiffAdapter in project webanno by webanno.
the class CasDiff2Test method noDifferencesPosTest.
@Test
public void noDifferencesPosTest() throws Exception {
Map<String, List<JCas>> casByUser = DiffUtils.load("casdiff/noDifferences/data.conll", "casdiff/noDifferences/data.conll");
List<String> entryTypes = asList(POS.class.getName());
List<SpanDiffAdapter> diffAdapters = asList(SpanDiffAdapter.POS);
DiffResult result = CasDiff2.doDiff(entryTypes, diffAdapters, LinkCompareBehavior.LINK_TARGET_AS_LABEL, casByUser);
result.print(System.out);
assertEquals(26, result.size());
assertEquals(0, result.getDifferingConfigurationSets().size());
assertEquals(0, result.getIncompleteConfigurationSets().size());
AgreementResult agreement = AgreementUtils.getCohenKappaAgreement(result, entryTypes.get(0), "PosValue", casByUser);
assertEquals(1.0d, agreement.getAgreement(), 0.000001d);
assertEquals(0, agreement.getIncompleteSetsByPosition().size());
}
use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.SpanDiffAdapter in project webanno by webanno.
the class CasDiff2Test method someDifferencesTest.
@Test
public void someDifferencesTest() throws Exception {
Map<String, List<JCas>> casByUser = DiffUtils.load("casdiff/someDifferences/user1.conll", "casdiff/someDifferences/user2.conll");
List<String> entryTypes = asList(POS.class.getName());
List<SpanDiffAdapter> diffAdapters = asList(SpanDiffAdapter.POS);
DiffResult result = CasDiff2.doDiff(entryTypes, diffAdapters, LinkCompareBehavior.LINK_TARGET_AS_LABEL, casByUser);
result.print(System.out);
assertEquals(26, result.size());
assertEquals(4, result.getDifferingConfigurationSets().size());
assertEquals(0, result.getIncompleteConfigurationSets().size());
AgreementResult agreement = AgreementUtils.getCohenKappaAgreement(result, 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.CasDiff2.SpanDiffAdapter in project webanno by webanno.
the class CasDiff2Test method singleEmptyCasTest.
@Test
public void singleEmptyCasTest() throws Exception {
String text = "";
JCas user1Cas = JCasFactory.createJCas();
user1Cas.setDocumentText(text);
Map<String, List<JCas>> casByUser = new LinkedHashMap<>();
casByUser.put("user1", asList(user1Cas));
List<String> entryTypes = asList(Token.class.getName());
List<SpanDiffAdapter> diffAdapters = asList(new SpanDiffAdapter(Token.class.getName()));
DiffResult result = CasDiff2.doDiff(entryTypes, diffAdapters, LinkCompareBehavior.LINK_TARGET_AS_LABEL, casByUser);
result.print(System.out);
assertEquals(0, result.size());
assertEquals(0, result.getDifferingConfigurationSets().size());
}
use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.SpanDiffAdapter in project webanno by webanno.
the class CasDiff2Test method singleNoDifferencesTest.
@Test
public void singleNoDifferencesTest() throws Exception {
Map<String, List<JCas>> casByUser = DiffUtils.load("casdiff/singleSpanNoDifference/data.conll", "casdiff/singleSpanNoDifference/data.conll");
List<String> entryTypes = asList(POS.class.getName());
List<? extends DiffAdapter> diffAdapters = asList(new SpanDiffAdapter(POS.class.getName(), "PosValue"));
DiffResult result = CasDiff2.doDiff(entryTypes, diffAdapters, LinkCompareBehavior.LINK_TARGET_AS_LABEL, casByUser);
result.print(System.out);
assertEquals(1, result.size());
assertEquals(0, result.getDifferingConfigurationSets().size());
assertEquals(0, result.getIncompleteConfigurationSets().size());
AgreementResult agreement = AgreementUtils.getCohenKappaAgreement(result, entryTypes.get(0), "PosValue", casByUser);
assertEquals(Double.NaN, agreement.getAgreement(), 0.000001d);
assertEquals(0, agreement.getIncompleteSetsByPosition().size());
}
Aggregations