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");
}
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");
}
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();
}
Aggregations