Search in sources :

Example 11 with Match

use of de.ids_mannheim.korap.response.Match in project Krill by KorAP.

the class TestMatchIdentifier method indexDependencyAnnotations.

@Test
public void indexDependencyAnnotations() throws IOException, QueryException {
    KrillIndex ki = new KrillIndex();
    FieldDocument fd = ki.addDoc(2, getClass().getResourceAsStream("/goe/Corpus-Doc-0002.json"), false);
    ki.commit();
    Match km;
    km = ki.getMatchInfo("match-Corpus/Doc/0002-p0-6", "tokens", "malt", null, true, false);
    assertEquals("SnippetHTML (1)", "<span class=\"context-left\">" + "</span>" + "<span class=\"match\">" + "<span xml:id=\"token-Corpus/Doc/0002-p0-6\">" + "<mark>" + "<span xml:id=\"token-Corpus/Doc/0002-p0\">" + "<span xlink:title=\"malt/d:ROOT\" xlink:show=\"none\" xlink:href=\"#token-Corpus/Doc/0002-p0-6\">Maximen</span>" + "</span>" + " " + "<span xml:id=\"token-Corpus/Doc/0002-p1\">" + "<span xlink:title=\"malt/d:KON\" xlink:show=\"none\" xlink:href=\"#token-Corpus/Doc/0002-p0\">und</span>" + "</span>" + " " + "<span xlink:title=\"malt/d:CJ\" xlink:show=\"none\" xlink:href=\"#token-Corpus/Doc/0002-p1\">Reflexionen</span>" + " " + "<span xml:id=\"token-Corpus/Doc/0002-p3\">" + "<span xlink:title=\"malt/d:KON\" xlink:show=\"none\" xlink:href=\"#token-Corpus/Doc/0002-p0\">Religion</span>" + "</span>" + " " + "<span xml:id=\"token-Corpus/Doc/0002-p4\">" + "<span xlink:title=\"malt/d:KON\" xlink:show=\"none\" xlink:href=\"#token-Corpus/Doc/0002-p3\">und</span>" + "</span>" + " " + "<span xlink:title=\"malt/d:CJ\" xlink:show=\"none\" xlink:href=\"#token-Corpus/Doc/0002-p4\">Christentum</span>" + "</mark>" + "</span>" + "</span>" + "<span class=\"context-right\">" + "<span class=\"more\"></span>" + "</span>", km.getSnippetHTML());
}
Also used : FieldDocument(de.ids_mannheim.korap.index.FieldDocument) KrillIndex(de.ids_mannheim.korap.KrillIndex) Match(de.ids_mannheim.korap.response.Match) Test(org.junit.Test)

Example 12 with Match

use of de.ids_mannheim.korap.response.Match in project Krill by KorAP.

the class TestMatchIdentifier method indexExample6Spans.

@Test
public void indexExample6Spans() throws IOException, QueryException {
    KrillIndex ki = new KrillIndex();
    ki.addDoc(createSimpleFieldDoc());
    ki.commit();
    Match km = ki.getMatchInfo("match-c1!d1-p7-10(4)8-8(2)7-8", "tokens", null, null, true, false);
    assertEquals("SnippetBrackets (1)", "... [[{x/tag:{f/m:acht:{f/y:eight:{it/is:8:{x/o:achtens:b}}}}{f/m:neun:{f/y:nine:{it/is:9:{x/o:neuntens:a}}}}{f/m:zehn:{f/y:ten:{it/is:10:{x/o:zehntens:c}}}}}]]", km.getSnippetBrackets());
}
Also used : KrillIndex(de.ids_mannheim.korap.KrillIndex) Match(de.ids_mannheim.korap.response.Match) Test(org.junit.Test)

Example 13 with Match

use of de.ids_mannheim.korap.response.Match in project Krill by KorAP.

the class TestMatchIdentifier method indexExample6Relations.

@Test
public void indexExample6Relations() throws IOException, QueryException {
    KrillIndex ki = new KrillIndex();
    ki.addDoc(createSimpleFieldDoc());
    ki.commit();
    Match km = ki.getMatchInfo("match-c1!d1-p0-5(4)8-8(2)7-8", "tokens", "x", null, true, false);
    assertEquals("SnippetBrackets (1)", "[[{x/o:erstens:{x/rel:a>3:a}}{x/o:zweitens:b}{x/o:drittens:c}{#3:{x/o:viertens:a}}{x/o:fünftens:b}]] ...", km.getSnippetBrackets());
    assertEquals("SnippetHTML (1)", "<span class=\"context-left\">" + "</span>" + "<span class=\"match\">" + "<mark>" + "<span title=\"x/o:erstens\">" + "<span xlink:title=\"x/rel:a\" xlink:show=\"none\" " + "xlink:href=\"#token-c1!d1-p3\">" + "a" + "</span>" + "</span>" + "<span title=\"x/o:zweitens\">" + "b" + "</span>" + "<span title=\"x/o:drittens\">" + "c" + "</span>" + "<span xml:id=\"token-c1!d1-p3\">" + "<span title=\"x/o:viertens\">" + "a" + "</span>" + "</span>" + "<span title=\"x/o:fünftens\">" + "b" + "</span>" + "</mark>" + "</span>" + "<span class=\"context-right\">" + "<span class=\"more\">" + "</span>" + "</span>", km.getSnippetHTML());
    km = ki.getMatchInfo("match-c1!d1-p0-5(7)2-3(4)8-8(2)7-8", "tokens", "x", null, true, true);
    assertEquals("SnippetHTML (2)", "<span class=\"context-left\">" + "</span>" + "<span class=\"match\">" + "<mark>" + "<span title=\"x/o:erstens\">" + "<span xlink:title=\"x/rel:a\" " + "xlink:show=\"none\" " + "xlink:href=\"#token-c1!d1-p3\">a</span>" + "</span>" + "<span title=\"x/o:zweitens\">b</span>" + "<mark class=\"class-7 level-0\">" + "<span title=\"x/o:drittens\">c</span>" + "<span xml:id=\"token-c1!d1-p3\">" + "<span title=\"x/o:viertens\">a</span>" + "</span>" + "</mark>" + "<span title=\"x/o:fünftens\">b</span>" + "</mark>" + "</span>" + "<span class=\"context-right\">" + "<span class=\"more\"></span>" + "</span>", km.getSnippetHTML());
}
Also used : KrillIndex(de.ids_mannheim.korap.KrillIndex) Match(de.ids_mannheim.korap.response.Match) Test(org.junit.Test)

Example 14 with Match

use of de.ids_mannheim.korap.response.Match in project Krill by KorAP.

the class TestMatchIdentifier method indexMultipleSpanStarts.

@Test
public void indexMultipleSpanStarts() throws IOException, QueryException {
    KrillIndex ki = new KrillIndex();
    ki.addDoc(createSimpleFieldDoc5());
    FieldDocument fd = ki.addDoc(2, getClass().getResourceAsStream("/goe/AGA-03828-new.json.gz"), true);
    ki.commit();
    Match km;
    km = ki.getMatchInfo("match-c1!d5-p0-4", "tokens", null, null, true, false);
    assertEquals("SnippetBrackets (with Spans)", "[[{x/tag:a:{x/tag:b:{x/tag:c:{x/tag:v:x}}y}}z]]", km.getSnippetBrackets());
    assertEquals(fd.getTextSigle(), "GOE/AGA/03828");
    assertEquals(fd.getTitle(), "Autobiographische Einzelheiten");
    Krill ks = new Krill(new QueryBuilder("tokens").seg("marmot/m:case:nom").with("marmot/m:degree:pos"));
    Result kr = ks.apply(ki);
    assertEquals(83, kr.getTotalResults());
    assertEquals("match-GOE/AGA/03828-p0-1", kr.getMatch(0).getID());
    km = ki.getMatchInfo("match-GOE/AGA/03828-p0-10", "tokens", "malt", null, true, false);
    assertEquals("SnippetBrackets (with Spans)", "[[{malt/d:ATTR>2:Autobiographische} " + "{malt/d:ATTR>2:einzelheiten} " + "{#2:{malt/d:ROOT>0-21:Selbstschilderung}} " + "({malt/d:APP>2:1}) " + "{malt/d:ADV>5:immer} " + "{#5:{malt/d:ATTR>2:tätiger}}, " + "{#6:{malt/d:PP>13:nach}} " + "{#7:{malt/d:PN>6:innen}} " + "{malt/d:KON>7:und} " + "{malt/d:ADV>11:außen}]] " + "...", km.getSnippetBrackets());
}
Also used : Krill(de.ids_mannheim.korap.Krill) QueryBuilder(de.ids_mannheim.korap.query.QueryBuilder) FieldDocument(de.ids_mannheim.korap.index.FieldDocument) KrillIndex(de.ids_mannheim.korap.KrillIndex) Match(de.ids_mannheim.korap.response.Match) Result(de.ids_mannheim.korap.response.Result) Test(org.junit.Test)

Example 15 with Match

use of de.ids_mannheim.korap.response.Match in project Krill by KorAP.

the class TestMatchIdentifier method snippetBugTest2.

@Test
public void snippetBugTest2() throws IOException, QueryException {
    KrillIndex ki = new KrillIndex();
    ki.addDoc(getClass().getResourceAsStream("/wiki/wdd17-982-72848.json.gz"), true);
    ki.commit();
    Match km = ki.getMatchInfo("match-WDD17/982/72848-p15844-15846", "tokens", "lwc", "d", true, true, true);
    String snippet = km.getSnippetHTML();
    assertEquals("SnippetBrackets (with Spans)", snippet, "<span class=\"context-left\"></span>" + "<span class=\"match\">" + "<span xml:id=\"token-WDD17/982/72848-p15836-15839\">" + "<span xlink:title=\"lwc/d:NK\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15838\">Ein</span>" + " " + "<span xlink:title=\"lwc/d:NK\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15838\">letztes</span>" + " " + "<span xml:id=\"token-WDD17/982/72848-p15838\">" + "<span xlink:title=\"lwc/d:--\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15836-15839\">mal</span>" + "</span>" + ": " + "<span xml:id=\"token-WDD17/982/72848-p15839-15840\">" + "<span xlink:title=\"lwc/d:--\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15839-15840\">AL</span>" + "</span>" + "</span>" + "<span xlink:show=\"other\" data-action=\"join\" xlink:href=\"#token-WDD17/982/72848-p15839-15840\">" + ":" + "<span xml:id=\"token-WDD17/982/72848-p15840-15846\">" + "<span xml:id=\"token-WDD17/982/72848-p15840\">" + "<span xlink:title=\"lwc/d:--\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15840-15846\">halt</span>" + "</span>" + "</span>" + "</span>" + // "<span xml:id=\"token-WDD17/982/72848-p15840-15846\">"+
    "<span xlink:show=\"other\" data-action=\"join\" xlink:href=\"#token-WDD17/982/72848-p15840-15846\">" + " " + "<span xlink:title=\"lwc/d:NK\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15842\">den</span>" + " " + "<span xml:id=\"token-WDD17/982/72848-p15842\">" + "<span xlink:title=\"lwc/d:OA\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15843\">Ball</span>" + "</span>" + " " + "<span xml:id=\"token-WDD17/982/72848-p15843\">" + "<span xlink:title=\"lwc/d:PD\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15840\">flach</span>" + "</span>" + ", " + "<mark>" + "<span xlink:title=\"lwc/d:MO\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15845\">ganz</span>" + " " + "<span xml:id=\"token-WDD17/982/72848-p15845\">" + "<span xlink:title=\"lwc/d:CJ\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15843\">flach</span>" + "</span>" + "</mark>" + "." + "</span>" + "</span>" + "<span class=\"context-right\"></span>");
}
Also used : KrillIndex(de.ids_mannheim.korap.KrillIndex) Match(de.ids_mannheim.korap.response.Match) Test(org.junit.Test)

Aggregations

Match (de.ids_mannheim.korap.response.Match)37 Test (org.junit.Test)34 KrillIndex (de.ids_mannheim.korap.KrillIndex)30 Result (de.ids_mannheim.korap.response.Result)9 JsonNode (com.fasterxml.jackson.databind.JsonNode)8 QueryBuilder (de.ids_mannheim.korap.query.QueryBuilder)8 FieldDocument (de.ids_mannheim.korap.index.FieldDocument)7 Krill (de.ids_mannheim.korap.Krill)5 SpanQuery (org.apache.lucene.search.spans.SpanQuery)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 SpanClassQuery (de.ids_mannheim.korap.query.SpanClassQuery)1 SpanFocusQuery (de.ids_mannheim.korap.query.SpanFocusQuery)1 SpanNextQuery (de.ids_mannheim.korap.query.SpanNextQuery)1 SearchContext (de.ids_mannheim.korap.response.SearchContext)1 ArrayList (java.util.ArrayList)1 Term (org.apache.lucene.index.Term)1 SpanTermQuery (org.apache.lucene.search.spans.SpanTermQuery)1 Ignore (org.junit.Ignore)1