use of annis.service.ifaces.AnnisToken in project ANNIS by korpling.
the class AnnisResultImpl method getTokenList.
public List<AnnisToken> getTokenList() {
List<AnnisToken> result = new ArrayList<AnnisToken>();
for (AnnisNode node : graph.getTokens()) {
AnnisTokenImpl annisToken = new AnnisTokenImpl(node.getId(), node.getSpannedText(), node.getLeft(), node.getRight(), node.getTokenIndex(), node.getCorpus());
for (Annotation annotation : node.getNodeAnnotations()) {
annisToken.put(annotation.getQualifiedName(), annotation.getValue());
}
result.add(annisToken);
}
return result;
}
use of annis.service.ifaces.AnnisToken in project ANNIS by korpling.
the class PartiturVisualizer method checkRTL.
private boolean checkRTL(List<AnnisToken> tokenList) {
if (Helper.isRTLDisabled()) {
return false;
}
Iterator<AnnisToken> itToken = tokenList.listIterator();
while (itToken.hasNext()) {
AnnisToken tok = itToken.next();
String tokText = tok.getText();
if (CommonHelper.containsRTLText(tokText)) {
return true;
}
}
return false;
}
use of annis.service.ifaces.AnnisToken in project ANNIS by korpling.
the class TestAnnisResultImpl method getTokenList.
// convert token list
@Test
public void getTokenList() {
// expected
List<AnnisToken> expected = new ArrayList<>();
expected.add(new AnnisTokenImpl(ID1, TEXT1, LEFT, RIGHT, TOKEN_INDEX1, 1L));
expected.add(new AnnisTokenImpl(ID2, TEXT2, LEFT, RIGHT, TOKEN_INDEX2, 1L));
expected.add(new AnnisTokenImpl(ID3, TEXT3, LEFT, RIGHT, TOKEN_INDEX3, 1L));
// wrap and test
AnnisResult annisResult = new AnnisResultImpl(graph);
assertThat(annisResult.getTokenList(), is(expected));
}
Aggregations