use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.ArcDiffAdapter in project webanno by webanno.
the class MergeCasTest method relationLabelTestTest.
@Test
public void relationLabelTestTest() throws Exception {
Map<String, List<JCas>> casByUser = DiffUtils.load("casdiff/relationLabel/user1.conll", "casdiff/relationLabel/user2.conll");
List<String> entryTypes = asList(Dependency.class.getName());
List<? extends DiffAdapter> diffAdapters = asList(new ArcDiffAdapter(Dependency.class.getName(), "Dependent", "Governor", "DependencyType"));
addRandomMergeCas(casByUser);
DiffResult result = CasDiff2.doDiff(entryTypes, diffAdapters, LinkCompareBehavior.LINK_TARGET_AS_LABEL, casByUser);
result.print(System.out);
JCas mergeCas = MergeCas.reMergeCas(result, getSingleCasByUser(casByUser));
JCas actual = DiffUtils.read("casdiff/relationLabel/merge.conll");
casByUser = new HashMap<>();
casByUser.put("actual", asList(actual));
casByUser.put("merge", asList(mergeCas));
result = CasDiff2.doDiff(entryTypes, diffAdapters, LinkCompareBehavior.LINK_TARGET_AS_LABEL, casByUser);
assertEquals(0, result.getDifferingConfigurationSets().size());
assertEquals(0, result.getIncompleteConfigurationSets().size());
}
use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.ArcDiffAdapter in project webanno by webanno.
the class MergeCasTest method simpleRelTypeDiffTest.
@Test
public void simpleRelTypeDiffTest() throws Exception {
Map<String, List<JCas>> casByUser = DiffUtils.loadWebAnnoTSV(null, "mergecas/rels/1sentencesamerel.tsv", "mergecas/rels/1sentencesamerel4.tsv");
List<String> entryTypes = asList(Dependency.class.getName(), POS.class.getName());
List<? extends DiffAdapter> diffAdapters = asList(new ArcDiffAdapter(Dependency.class.getName(), "Dependent", "Governor", "DependencyType"), SpanDiffAdapter.POS);
addRandomMergeCas(casByUser);
DiffResult result = CasDiff2.doDiff(entryTypes, diffAdapters, LinkCompareBehavior.LINK_TARGET_AS_LABEL, casByUser);
JCas mergeCas = MergeCas.reMergeCas(result, getSingleCasByUser(casByUser));
casByUser = new HashMap<>();
JCas actual = DiffUtils.readWebAnnoTSV("mergecas/rels/1sentencesamerel5.tsv", null);
casByUser.put("actual", asList(actual));
casByUser.put("merge", asList(mergeCas));
result = CasDiff2.doDiff(entryTypes, diffAdapters, LinkCompareBehavior.LINK_TARGET_AS_LABEL, casByUser);
assertEquals(0, result.getDifferingConfigurationSets().size());
assertEquals(0, result.getIncompleteConfigurationSets().size());
}
use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.ArcDiffAdapter in project webanno by webanno.
the class TwoPairedKappaTest method testTwoUserDiffArcAndSpanAnnotation.
@Test
public void testTwoUserDiffArcAndSpanAnnotation() throws Exception {
Map<User, List<SourceDocument>> userDocs = new HashMap<>();
userDocs.put(user1, asList(document));
userDocs.put(user2, asList(document));
Map<User, JCas> userCases = new HashMap<>();
userCases.put(user1, kappatestCas.getJCas());
userCases.put(user2, kappaspanarcdiff.getJCas());
Map<SourceDocument, Map<User, JCas>> documentJCases = new HashMap<>();
documentJCases.put(document, userCases);
// Check against new impl
DiffResult diff = CasDiff2.doDiff(Dependency.class, new ArcDiffAdapter(Dependency.class, "Dependent", "Governor", "DependencyType"), LinkCompareBehavior.LINK_TARGET_AS_LABEL, convert(userCases));
AgreementResult agreement = AgreementUtils.getCohenKappaAgreement(diff, Dependency.class.getName(), "DependencyType", convert(userCases));
// Asserts
System.out.printf("Agreement: %s%n", agreement.toString());
diff.print(System.out);
AgreementUtils.dumpAgreementStudy(System.out, agreement);
assertEquals(0.86153d, agreement.getAgreement(), 0.00001d);
assertEquals(9, diff.size());
assertEquals(1, diff.getDifferingConfigurationSets().size());
assertEquals(0, diff.getIncompleteConfigurationSets().size());
}
use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.ArcDiffAdapter in project webanno by webanno.
the class MergeCasTest method simpleRelGovStackedTest.
@Test
public void simpleRelGovStackedTest() throws Exception {
TypeSystemDescription customeTypesSpan = DiffUtils.createCustomTypeSystem(SPAN_TYPE, "webanno.custom.Multivalspan", asList("f1", "f2"), null);
TypeSystemDescription customeTypesRel = DiffUtils.createCustomTypeSystem(RELATION_TYPE, "webanno.custom.Multivalrel", asList("rel1", "rel2"), "webanno.custom.Multivalspan");
List<TypeSystemDescription> customTypes = new ArrayList<>();
customTypes.add(customeTypesSpan);
customTypes.add(customeTypesRel);
TypeSystemDescription customType = CasCreationUtils.mergeTypeSystems(customTypes);
Map<String, List<JCas>> casByUser = DiffUtils.loadWebAnnoTSV(customType, "mergecas/multivalspanrel/tale.tsv", "mergecas/multivalspanrel/tale.tsv");
List<String> entryTypes = asList("webanno.custom.Multivalspan", "webanno.custom.Multivalrel");
List<? extends DiffAdapter> diffAdapters = asList(new ArcDiffAdapter("webanno.custom.Multivalrel", "Dependent", "Governor", "rel1", "rel2"), new SpanDiffAdapter("webanno.custom.Multivalspan", "f1", "f2"));
addRandomMergeCas(casByUser);
DiffResult result = CasDiff2.doDiff(entryTypes, diffAdapters, LinkCompareBehavior.LINK_TARGET_AS_LABEL, casByUser);
JCas mergeCas = MergeCas.reMergeCas(result, getSingleCasByUser(casByUser));
casByUser = new HashMap<>();
JCas actual = DiffUtils.readWebAnnoTSV("mergecas/multivalspanrel/tale2.tsv", customType);
casByUser.put("actual", asList(actual));
casByUser.put("merge", asList(mergeCas));
result = CasDiff2.doDiff(entryTypes, diffAdapters, LinkCompareBehavior.LINK_TARGET_AS_LABEL, casByUser);
assertEquals(0, result.getDifferingConfigurationSets().size());
assertEquals(0, result.getIncompleteConfigurationSets().size());
}
use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.ArcDiffAdapter in project webanno by webanno.
the class MergeCasTest method simpleRelNoDiffTest.
@Test
public void simpleRelNoDiffTest() throws Exception {
Map<String, List<JCas>> casByUser = DiffUtils.loadWebAnnoTSV(null, "mergecas/rels/1sentencesamerel.tsv", "mergecas/rels/1sentencesamerel.tsv");
List<String> entryTypes = asList(Dependency.class.getName(), POS.class.getName());
List<? extends DiffAdapter> diffAdapters = asList(new ArcDiffAdapter(Dependency.class.getName(), "Dependent", "Governor", "DependencyType"), SpanDiffAdapter.POS);
addRandomMergeCas(casByUser);
DiffResult result = CasDiff2.doDiff(entryTypes, diffAdapters, LinkCompareBehavior.LINK_TARGET_AS_LABEL, casByUser);
JCas mergeCas = MergeCas.reMergeCas(result, getSingleCasByUser(casByUser));
casByUser = new HashMap<>();
JCas actual = DiffUtils.readWebAnnoTSV("mergecas/rels/1sentencesamerel.tsv", null);
casByUser.put("actual", asList(actual));
casByUser.put("merge", asList(mergeCas));
result = CasDiff2.doDiff(entryTypes, diffAdapters, LinkCompareBehavior.LINK_TARGET_AS_LABEL, casByUser);
assertEquals(0, result.getDifferingConfigurationSets().size());
assertEquals(0, result.getIncompleteConfigurationSets().size());
}
Aggregations