code: public static void annotateChunk(CoreMap chunk,
                                     List<CoreLabel> tokens, int tokenStartIndex, int tokenEndIndex,  int totalTokenOffset)
    {
      List<CoreLabel> chunkTokens = new ArrayList<CoreLabel>(tokens.subList(tokenStartIndex, tokenEndIndex));
      chunk.set(CoreAnnotations.CharacterOffsetBeginAnnotation.class,
              chunkTokens.get(0).get(CoreAnnotations.CharacterOffsetBeginAnnotation.class));
      chunk.set(CoreAnnotations.CharacterOffsetEndAnnotation.class,
              chunkTokens.get(chunkTokens.size()-1).get(CoreAnnotations.CharacterOffsetEndAnnotation.class));
      chunk.set(CoreAnnotations.TokensAnnotation.class, chunkTokens);
      chunk.set(CoreAnnotations.TokenBeginAnnotation.class, tokenStartIndex+totalTokenOffset);
      chunk.set(CoreAnnotations.TokenEndAnnotation.class, tokenEndIndex+totalTokenOffset);
    }
docs: Annotates a CoreMap representing a chunk with basic chunk information
  CharacterOffsetBeginAnnotation - set to CharacterOffsetBeginAnnotation of first token in chunk
  CharacterOffsetEndAnnotation - set to CharacterOffsetEndAnnotation of last token in chunk
  TokensAnnotation - List of tokens in this chunk
  TokenBeginAnnotation - Index of first token in chunk (index in original list of tokens)
  tokenStartIndex + totalTokenOffset
  TokenEndAnnotation - Index of last token in chunk (index in original list of tokens)
  tokenEndIndex + totalTokenOffset
  @param chunk - CoreMap to be annotated
  @param tokens - List of tokens to look for chunks
  @param tokenStartIndex - Index (relative to current list of tokens) at which this chunk starts
  @param tokenEndIndex - Index (relative to current list of tokens) at which this chunk ends (not inclusive)
  @param totalTokenOffset - Index of tokens to offset by