for (int i = 0; i < tokens.length; i++) {
tokens[i] = tokSpans[i].getCoveredText(sentence).toString();
// System.out.println(tokens[i]);
}
String[] tags = posTagger.tag(tokens);
Span[] chunks = chunker.chunkAsSpans(tokens, tags);
for (Span chunk : chunks) {
if ("NP".equals(chunk.getType())) {
//Note: getStart()/getEnd() methods of Chunk spans only give the start and end token indexes of the chunk.
//The actual Start/End positions of the chunk in the sentence need to be extracted from POS sentenceSpans.
//They are offsets from the begining of the sentence in question. Need to add the start postion of the sentence