code: def test_should_build_training_data_with_unknown_noise(
      self, mocked_augment_utterances
  ):
      # Given
      mocked_noises = ["mocked_noise_%s" % i for i in range(100)]
      resources = {NOISE: mocked_noises}
      mocked_augment_utterances.side_effect = (
          get_mocked_augment_utterances
      )
  
      num_intents = 3
      utterances_length = 5
      num_queries_per_intent = 3
      fake_utterance = {
          "data": [
              {"text": " ".join("1" for _ in range(utterances_length))}
          ]
      }
      dataset = {
          "intents": {
              str(i): {
                  "utterances": [fake_utterance]
                  * num_queries_per_intent
              }
              for i in range(num_intents)
          },
          "entities": {},
      }
      random_state = np.random.RandomState(1)
  
      # When
      np.random.seed(42)
      noise_factor = 2
      replacement_string = "unknownword"
      data_augmentation_config = IntentClassifierDataAugmentationConfig(
          noise_factor=noise_factor,
          unknown_word_prob=0,
          unknown_words_replacement_string=replacement_string,
      )
      utterances, _, intent_mapping = build_training_data(
          dataset,
          LANGUAGE_EN,
          data_augmentation_config,
          resources,
          random_state,
      )
  
      # Then
      expected_utterances = [
          utterance
          for intent in itervalues(dataset[INTENTS])
          for utterance in intent[UTTERANCES]
      ]
      np.random.seed(42)
      noise = list(mocked_noises)
      noise_size = int(
          min(noise_factor * num_queries_per_intent, len(noise))
      )
      noisy_utterances = [
          text_to_utterance(replacement_string)
          for _ in range(noise_size)
      ]
      expected_utterances += noisy_utterances
      expected_intent_mapping = sorted(dataset["intents"])
      expected_intent_mapping.append(None)
      self.assertListEqual(expected_utterances, utterances)
      self.assertListEqual(expected_intent_mapping, intent_mapping)
  
imports: from __future__ import unicode_literals
  import io
  from copy import deepcopy
  from itertools import cycle
  import numpy
  from future.utils import itervalues, iteritems
  from mock import MagicMock, patch
  from snips_nlu.constants import INTENTS, LANGUAGE_EN, UTTERANCES, LANGUAGE, NOISE
  from snips_nlu.dataset import validate_and_format_dataset, Dataset
  from snips_nlu.intent_classifier.log_reg_classifier_utils import add_unknown_word_to_utterances, build_training_data, generate_noise_utterances, generate_smart_noise, get_noise_it, remove_builtin_slots, text_to_utterance
  from snips_nlu.pipeline.configs import IntentClassifierDataAugmentationConfig, LogRegIntentClassifierConfig
  from snips_nlu.tests.test_log_reg_intent_classifier import get_mocked_augment_utterances
  from snips_nlu.tests.utils import SnipsTest, get_empty_dataset
label_desc: Use image node_id 5 for calling the TestLogRegClassifierUtils obj's underlying member method code with example usage: obj.test_should_build_training_data_with_unknown_noise(mocked_augment_utterances) without return types