nerChunks.add(nerChunk);
Tree t = getTreeNonTerminal(tree, startToken, endToken, true);
if (t.getSpan().getSource() == startToken && t.getSpan().getTarget() == endToken) {
nerChunk.set(TreeCoreAnnotations.TreeAnnotation.class, t);
if (options.annotateTreeNer) {
Label tlabel = t.label();
if (tlabel instanceof CoreLabel) {
((CoreLabel) tlabel).set(NamedEntityAnnotation.class, nerChunk);
}
}
}
}
List<Triple<Integer,Integer,String>> corefSpans = getCorefSpans(sentWords);
for (Triple<Integer,Integer,String> corefSpan:corefSpans) {
int startToken = corefSpan.first();
int endToken = corefSpan.second(); /* inclusive */
String corefId = corefSpan.third();
CoreMap mention = ChunkAnnotationUtils.getAnnotatedChunk(sentence, startToken, endToken+1);
mention.set(CorefCoreAnnotations.CorefAnnotation.class, corefId);
mention.set(CoreAnnotations.SentenceIndexAnnotation.class, sentence.get(CoreAnnotations.SentenceIndexAnnotation.class));
corefChainMap.add(corefId, mention);
Tree t = getTreeNonTerminal(tree, startToken, endToken, true);
mention.set(TreeCoreAnnotations.TreeAnnotation.class, t);
if (options.annotateTreeCoref) {
Label tlabel = t.label();
if (tlabel instanceof CoreLabel) {
((CoreLabel) tlabel).set(CorefMentionAnnotation.class, mention);
}
}
}