code: public static void mergeChunks(List<CoreMap> chunkList, String origText,
                                   int chunkIndexStart, int chunkIndexEnd)
    {
      CoreMap newChunk = getMergedChunk(chunkList, origText, chunkIndexStart, chunkIndexEnd);
      int nChunksToRemove = chunkIndexEnd - chunkIndexStart - 1;
      for (int i = 0; i < nChunksToRemove; i++) {
        chunkList.remove(chunkIndexStart);
      }
      chunkList.set(chunkIndexStart, newChunk);
    }
docs: Merge chunks from chunkIndexStart to chunkIndexEnd (exclusive) and replace them in the list
  @param chunkList - List of chunks
  @param origText - Text from which to extract chunk text
  @param chunkIndexStart - Index of first chunk to merge
  @param chunkIndexEnd - Index of last chunk to merge (exclusive)