code: def build_training_data(
      dataset,
      language,
      data_augmentation_config,
      resources,
      random_state,
  ):
      import numpy as np
  
      # Create class mapping
      intents = dataset[INTENTS]
      intent_index = 0
      classes_mapping = dict()
      for intent in sorted(intents):
          classes_mapping[intent] = intent_index
          intent_index += 1
  
      noise_class = intent_index
  
      augmented_utterances = []
      utterance_classes = []
      for intent_name, intent_data in sorted(iteritems(intents)):
          nb_utterances = len(intent_data[UTTERANCES])
          min_utterances_to_generate = max(
              data_augmentation_config.min_utterances, nb_utterances
          )
          utterances = augment_utterances(
              dataset,
              intent_name,
              language=language,
              min_utterances=min_utterances_to_generate,
              capitalization_ratio=0.0,
              add_builtin_entities_examples=data_augmentation_config.add_builtin_entities_examples,
              resources=resources,
              random_state=random_state,
          )
          augmented_utterances += utterances
          utterance_classes += [
              classes_mapping[intent_name]
              for _ in range(len(utterances))
          ]
      if (
          data_augmentation_config.unknown_words_replacement_string
          is not None
      ):
          augmented_utterances = add_unknown_word_to_utterances(
              augmented_utterances,
              data_augmentation_config.unknown_words_replacement_string,
              data_augmentation_config.unknown_word_prob,
              data_augmentation_config.max_unknown_words,
              random_state,
          )
  
      # Adding noise
      noise = get_noise(resources)
      noisy_utterances = generate_noise_utterances(
          augmented_utterances,
          noise,
          len(intents),
          data_augmentation_config,
          language,
          random_state,
      )
  
      augmented_utterances += noisy_utterances
      utterance_classes += [noise_class for _ in noisy_utterances]
      if noisy_utterances:
          classes_mapping[NOISE_NAME] = noise_class
  
      nb_classes = len(set(itervalues(classes_mapping)))
      intent_mapping = [None for _ in range(nb_classes)]
      for intent, intent_class in iteritems(classes_mapping):
          if intent == NOISE_NAME:
              intent_mapping[intent_class] = None
          else:
              intent_mapping[intent_class] = intent
  
      return (
          augmented_utterances,
          np.array(utterance_classes),
          intent_mapping,
      )
  
imports: from __future__ import division, unicode_literals
  import itertools
  import re
  from builtins import next, range, str
  from copy import deepcopy
  from uuid import uuid4
  from future.utils import iteritems, itervalues
  from snips_nlu.constants import DATA, ENTITY, INTENTS, TEXT, UNKNOWNWORD, UTTERANCES
  from snips_nlu.data_augmentation import augment_utterances
  from snips_nlu.dataset import get_text_from_chunks
  from snips_nlu.entity_parser.builtin_entity_parser import is_builtin_entity
  from snips_nlu.preprocessing import tokenize_light
  from snips_nlu.resources import get_noise
label_desc: Use image node_id 7 for calling a global function with example usage: build_training_data(dataset, language, data_augmentation_config, resources, random_state) and returns: augmented_utterances,  np,  intent_mapping