Search in sources :

Example 1 with AnnisToken

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;
}
Also used : AnnisToken(annis.service.ifaces.AnnisToken) ArrayList(java.util.ArrayList) AnnisNode(annis.model.AnnisNode) Annotation(annis.model.Annotation)

Example 2 with AnnisToken

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;
}
Also used : AnnisToken(annis.service.ifaces.AnnisToken)

Example 3 with AnnisToken

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));
}
Also used : AnnisToken(annis.service.ifaces.AnnisToken) ArrayList(java.util.ArrayList) AnnisResult(annis.service.ifaces.AnnisResult) Test(org.junit.Test)

Aggregations

AnnisToken (annis.service.ifaces.AnnisToken)3 ArrayList (java.util.ArrayList)2 AnnisNode (annis.model.AnnisNode)1 Annotation (annis.model.Annotation)1 AnnisResult (annis.service.ifaces.AnnisResult)1 Test (org.junit.Test)1