def _group_chunks_by_entities(self, chunks, entities):
    """Groups chunks by entities retrieved from NL API Entity Analysis.

    Args:
      chunks (:obj:`budou.chunk.ChunkList`): List of chunks to be processed.
      entities (:obj:`list` of :obj:`dict`): List of entities.

    Returns:
      A chunk list. (:obj:`budou.chunk.ChunkList`)
    """
    for entity in entities:
      chunks_to_concat = chunks.get_overlaps(
          entity['beginOffset'], len(entity['content']))
      if not chunks_to_concat:
        continue
      new_chunk_word = u''.join([chunk.word for chunk in chunks_to_concat])
      new_chunk = Chunk(new_chunk_word)
      chunks.swap(chunks_to_concat, new_chunk)
    return chunks
Groups chunks by entities retrieved from NL API Entity Analysis.

    Args:
      chunks (:obj:`budou.chunk.ChunkList`): List of chunks to be processed.
      entities (:obj:`list` of :obj:`dict`): List of entities.

    Returns:
      A chunk list. (:obj:`budou.chunk.ChunkList`)