Search in sources :

Example 1 with PosIdentifier

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

the class TestMatchIdentifier method posIdentifierExample1.

@Test
public void posIdentifierExample1() throws IOException {
    PosIdentifier id = new PosIdentifier();
    id.setCorpusID("c1");
    id.setDocID("d1");
    id.setStart(8);
    assertEquals(id.getCorpusID(), "c1");
    assertEquals(id.getDocID(), "d1");
    assertEquals(id.getStart(), 8);
    assertEquals(id.toString(), "token-c1!d1-p8");
}
Also used : PosIdentifier(de.ids_mannheim.korap.response.match.PosIdentifier) Test(org.junit.Test)

Example 2 with PosIdentifier

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

the class TestMatchIdentifier method posIdentifierExample2.

@Test
public void posIdentifierExample2() throws IOException {
    PosIdentifier id = new PosIdentifier();
    id.setCorpusID("c1");
    id.setDocID("d1");
    id.setStart(8);
    id.setEnd(12);
    assertEquals(id.getCorpusID(), "c1");
    assertEquals(id.getDocID(), "d1");
    assertEquals(id.getStart(), 8);
    assertEquals(id.getEnd(), 12);
    assertEquals(id.toString(), "token-c1!d1-p8-12");
}
Also used : PosIdentifier(de.ids_mannheim.korap.response.match.PosIdentifier) Test(org.junit.Test)

Example 3 with PosIdentifier

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

the class Match method getPosID.

/**
 * Get identifier for a specific position.
 *
 * @param int
 *            Start position to get identifier on.
 * @param int
 *            End position to get identifier on.
 */
@JsonIgnore
public String getPosID(int start, int end) {
    if (DEBUG)
        log.trace("Retrieve identifier for position {}-{}", start, end);
    // Identifier already given
    if (this.identifier != null)
        return this.identifier;
    // Nothing here
    if (this.localDocID == -1)
        return null;
    PosIdentifier id = new PosIdentifier();
    // Get prefix string corpus/doc
    // <legacy>
    id.setCorpusID(this.getCorpusID());
    id.setDocID(this.getDocID());
    // </legacy>
    id.setTextSigle(this.getTextSigle());
    id.setStart(start);
    id.setEnd(end);
    if (DEBUG)
        log.trace("Identifier is {} in {} ({}-{}) {}", id.toString(), this.getTextSigle(), this.getCorpusID(), this.getDocID(), start);
    return id.toString();
}
Also used : PosIdentifier(de.ids_mannheim.korap.response.match.PosIdentifier) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Aggregations

PosIdentifier (de.ids_mannheim.korap.response.match.PosIdentifier)3 Test (org.junit.Test)2 JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)1