boolean start = chunkTags[i].charAt(0) == 'B';
boolean end = tag != null && (start || chunkTags[i].charAt(0) == 'O');
if(end){ //add the current phrase
//add at AnalysedText level, because offsets are absolute
//NOTE we are already at the next token when we detect the end
Chunk chunk = at.addChunk(
tokenList.get(i-chunkTokenCount).getStart(),
tokenList.get(i-1).getEnd());
chunk.addAnnotation(PHRASE_ANNOTATION,
new Value<PhraseTag>(tag,
chunkProps/(double)chunkTokenCount));