Search in sources :

Example 1 with Unit

use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.paging.Unit in project webanno by webanno.

the class BratRenderer method renderUnitsAsRows.

public static void renderUnitsAsRows(GetDocumentResponse aResponse, AnnotatorState aState) {
    int windowBegin = aState.getWindowBeginOffset();
    aResponse.setSentenceNumberOffset(aState.getFirstVisibleUnitIndex());
    // Render sentences
    int sentIdx = aResponse.getSentenceNumberOffset();
    for (Unit unit : aState.getVisibleUnits()) {
        aResponse.addSentence(unit.getBegin() - windowBegin, unit.getEnd() - windowBegin);
        // comment.
        if (isNotBlank(unit.getId())) {
            aResponse.addComment(new SentenceComment(sentIdx, Comment.ANNOTATOR_NOTES, String.format("Sentence ID: %s", unit.getId())));
        }
        sentIdx++;
    }
}
Also used : SentenceComment(de.tudarmstadt.ukp.clarin.webanno.brat.render.model.SentenceComment) Unit(de.tudarmstadt.ukp.clarin.webanno.api.annotation.paging.Unit)

Aggregations

Unit (de.tudarmstadt.ukp.clarin.webanno.api.annotation.paging.Unit)1 SentenceComment (de.tudarmstadt.ukp.clarin.webanno.brat.render.model.SentenceComment)1