use of de.ids_mannheim.korap.response.Match in project Krill by KorAP.
the class TestMatchIdentifier method indexSigleDuplicate.
@Test
public void indexSigleDuplicate() throws IOException, QueryException {
KrillIndex ki = new KrillIndex();
ki.addDoc(createSigleDoc2());
ki.addDoc(createSigleDoc1());
ki.commit();
Match km = ki.getMatchInfo("match-c1/d1/t1-p3-9", "tokens", null, null, false, false);
JsonNode res = mapper.readTree(km.toJsonString());
assertEquals("tokens", res.at("/field").asText());
assertTrue(res.at("/startMore").asBoolean());
assertTrue(res.at("/endMore").asBoolean());
assertEquals("c1", res.at("/corpusSigle").asText());
assertEquals("c1/d1", res.at("/docSigle").asText());
assertEquals("c1/d1/t1", res.at("/textSigle").asText());
assertEquals("match-c1/d1/t1-p3-9", res.at("/matchID").asText());
assertEquals(2, res.at("/UID").asInt());
}
use of de.ids_mannheim.korap.response.Match in project Krill by KorAP.
the class TestKrill method searchJSONwithPagebreaks.
@Test
public void searchJSONwithPagebreaks() throws IOException {
// Construct index
KrillIndex ki = new KrillIndex();
// Indexing test files
FieldDocument fd = ki.addDoc(1, getClass().getResourceAsStream("/goe/AGA-03828-pb.json.gz"), true);
ki.commit();
assertEquals(fd.getUID(), 1);
assertEquals(fd.getTextSigle(), "GOE/AGA/03828");
assertEquals(fd.getDocSigle(), "GOE/AGA");
assertEquals(fd.getCorpusSigle(), "GOE");
assertEquals(fd.getTitle(), "Autobiographische Einzelheiten");
assertNull(fd.getSubTitle());
assertEquals(fd.getTextType(), "Autobiographie");
assertNull(fd.getTextTypeArt());
assertNull(fd.getTextTypeRef());
assertNull(fd.getTextColumn());
assertNull(fd.getTextDomain());
// assertEquals(fd.getPages(), "529-547");
// assertEquals(fd.getAvailability(), "QAO-NC");
assertEquals(fd.getCreationDate().toString(), "18200000");
assertEquals(fd.getPubDate().toString(), "19820000");
assertEquals(fd.getAuthor(), "Goethe, Johann Wolfgang von");
assertNull(fd.getTextClass());
assertEquals(fd.getLanguage(), "de");
assertEquals(fd.getPubPlace(), "München");
assertEquals(fd.getReference(), "Goethe, Johann Wolfgang von:" + " Autobiographische Einzelheiten," + " (Geschrieben bis 1832), In: Goethe," + " Johann Wolfgang von: Goethes Werke," + " Bd. 10, Autobiographische Schriften" + " II, Hrsg.: Trunz, Erich. München: " + "Verlag C. H. Beck, 1982, S. 529-547");
assertEquals(fd.getPublisher(), "Verlag C. H. Beck");
assertNull(fd.getEditor());
assertNull(fd.getFileEditionStatement());
assertNull(fd.getBiblEditionStatement());
assertNull(fd.getKeywords());
assertEquals(fd.getTokenSource(), "base#tokens_aggr");
assertEquals(fd.getFoundries(), "dereko dereko/structure " + "dereko/structure/base-sentences-paragraphs-pagebreaks");
assertEquals(fd.getLayerInfos(), "dereko/s=spans");
assertEquals(fd.getCorpusTitle(), "Goethes Werke");
assertNull(fd.getCorpusSubTitle());
assertEquals(fd.getCorpusAuthor(), "Goethe, Johann Wolfgang von");
assertEquals(fd.getCorpusEditor(), "Trunz, Erich");
assertEquals(fd.getDocTitle(), "Goethe: Autobiographische Schriften II, (1817-1825, 1832)");
assertNull(fd.getDocSubTitle());
assertNull(fd.getDocEditor());
assertNull(fd.getDocAuthor());
Krill ks = new Krill(new QueryBuilder("tokens").seg("s:der"));
Result kr = ks.apply(ki);
assertEquals(kr.getTotalResults(), 97);
assertEquals(0, kr.getStartIndex());
assertEquals(25, kr.getItemsPerPage());
Match m = kr.getMatch(5);
assertEquals("Start page", m.getStartPage(), 529);
ObjectMapper mapper = new ObjectMapper();
JsonNode res = mapper.readTree(m.toJsonString());
assertEquals(529, res.at("/pages/0").asInt());
}
use of de.ids_mannheim.korap.response.Match in project Krill by KorAP.
the class TestSampleIndex method testMatchWithDependency.
@Test
public void testMatchWithDependency() throws IOException, QueryException {
// /GOE/AGA/01784/p104-105/matchInfo?layer=c&foundry=corenlp&spans=true
Match km = sample.getMatchInfo("match-GOE/AGD/00000-p132566-132569", "tokens", "corenlp", "c", true, true);
assertEquals(km.getSnippetBrackets(), "... [[meine eigne Erfahrung]] ...");
assertEquals(km.getSnippetHTML(), "<span class=\"context-left\"><span class=\"more\"></span></span><span class=\"match\"><mark>meine eigne Erfahrung</mark></span><span class=\"context-right\"><span class=\"more\"></span></span>");
km = sample.getMatchInfo("match-GOE/AGD/00000-p132566-132569", "tokens", "malt", "d", true, true);
// assertEquals(km.getSnippetBrackets(), "... [[{malt/d:DET>132567:meine} {#132567:{malt/d:ATTR>132567:eigne}} {malt/d:PN>132564:Erfahrung}]] ...");
assertEquals(km.getSnippetHTML(), "<span class=\"context-left\"><span class=\"more\"></span></span><span class=\"match\"><mark><span xlink:title=\"malt/d:DET\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGD/00000-p132567\">meine</span> <span xml:id=\"token-GOE/AGD/00000-p132567\"><span xlink:title=\"malt/d:ATTR\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGD/00000-p132567\">eigne</span></span> <span xlink:title=\"malt/d:PN\" xlink:type=\"simple\" xlink:href=\"#token-GOE/AGD/00000-p132564\">Erfahrung</span></mark></span><span class=\"context-right\"><span class=\"more\"></span></span>");
km = sample.getMatchInfo("match-GOE/AGD/00000-p132566-132569", "tokens", "malt", "d", true, true, true);
assertEquals(km.getSnippetBrackets().substring(0, 20), "[{#132507:{malt/d:SU");
assertEquals(km.getSnippetHTML().substring(0, 20), "<span class=\"context");
}
use of de.ids_mannheim.korap.response.Match in project Krill by KorAP.
the class TestMatch method testMatchBug.
@Test
public void testMatchBug() {
Match m = new Match("match-PRO-DUD!PRO-DUD_KSTA-2013-01.7483-2013-01", false);
assertEquals(null, m.getID());
}
use of de.ids_mannheim.korap.response.Match in project Krill by KorAP.
the class TestMatch method testMatchTextSigle1.
@Test
public void testMatchTextSigle1() {
Match m = new Match("match-GOE!GOE_AGK.00000-p60348-60349", false);
assertEquals("GOE_AGK.00000", m.getTextSigle());
}
Aggregations