code: def capitalize_utterances(
      utterances, entities, language, ratio, resources, random_state
  ):
      capitalized_utterances = []
      for utterance in utterances:
          capitalized_utterance = deepcopy(utterance)
          for i, chunk in enumerate(capitalized_utterance[DATA]):
              capitalized_utterance[DATA][i][TEXT] = chunk[TEXT].lower()
              if ENTITY not in chunk:
                  continue
              entity_label = chunk[ENTITY]
              if is_builtin_entity(entity_label):
                  continue
              if not entities[entity_label][CAPITALIZE]:
                  continue
              if random_state.rand() > ratio:
                  continue
              capitalized_utterance[DATA][i][TEXT] = capitalize(
                  chunk[TEXT], language, resources
              )
          capitalized_utterances.append(capitalized_utterance)
      return capitalized_utterances
  
file_path: snips-nlu/snips_nlu/data_augmentation.py
imports: from __future__ import unicode_literals
  from builtins import next
  from copy import deepcopy
  from itertools import cycle
  from future.utils import iteritems
  from snips_nlu.constants import CAPITALIZE, DATA, ENTITIES, ENTITY, INTENTS, TEXT, UTTERANCES
  from snips_nlu.entity_parser.builtin_entity_parser import is_builtin_entity
  from snips_nlu.languages import get_default_sep
  from snips_nlu.preprocessing import tokenize_light
  from snips_nlu.resources import get_stop_words
label_desc: Use image node_id 2 for calling a global function with example usage: capitalize_utterances(utterances, entities, language, ratio, resources, random_state) and returns: capitalized_utterances