code: def test_preprocess(self):
      # Given
      language = LANGUAGE_EN
      resources = {
          STEMS: {
              "beautiful": "beauty",
              "birdy": "bird",
              "entity": "ent",
          },
          WORD_CLUSTERS: {
              "my_word_clusters": {
                  "beautiful": "cluster_1",
                  "birdy": "cluster_2",
                  "entity": "cluster_3",
              }
          },
          STOP_WORDS: set(),
      }
  
      dataset_stream = io.StringIO(
          """
  ---
  type: intent
  name: intent1
  utterances:
      - dummy utterance
  
  ---
  type: entity
  name: entity_1
  values:
    - [entity 1, alternative entity 1]
    - [éntity 1, alternative entity 1]
  
  ---
  type: entity
  name: entity_2
  values:
    - entity 1
    - [Éntity 2, Éntity_2, Alternative entity 2]"""
      )
  
      dataset = Dataset.from_yaml_files("en", [dataset_stream]).json
  
      custom_entity_parser = CustomEntityParser.build(
          dataset, CustomEntityParserUsage.WITH_STEMS, resources
      )
  
      builtin_entity_parser = BuiltinEntityParser.build(
          dataset, language
      )
      utterances = [
          text_to_utterance("hÉllo wOrld Éntity_2"),
          text_to_utterance("beauTiful World entity 1"),
          text_to_utterance("Bird bïrdy"),
          text_to_utterance("Bird birdy"),
      ]
  
      config = TfidfVectorizerConfig(
          use_stemming=True, word_clusters_name="my_word_clusters"
      )
      vectorizer = TfidfVectorizer(
          config=config,
          custom_entity_parser=custom_entity_parser,
          builtin_entity_parser=builtin_entity_parser,
          resources=resources,
      )
      vectorizer._language = language
      vectorizer.builtin_entity_scope = {"snips/number"}
  
      # When
      processed_data = vectorizer._preprocess(utterances)
      processed_data = list(zip(*processed_data))
  
      # Then
      u_0 = {"data": [{"text": "hello world entity_2"}]}
  
      u_1 = {"data": [{"text": "beauty world ent 1"}]}
  
      u_2 = {"data": [{"text": "bird bird"}]}
  
      u_3 = {"data": [{"text": "bird bird"}]}
  
      ent_0 = {
          "entity_kind": "entity_2",
          "value": "entity_2",
          "resolved_value": "Éntity 2",
          "range": {"start": 12, "end": 20},
      }
      num_0 = {
          "entity_kind": "snips/number",
          "value": "2",
          "resolved_value": {"value": 2.0, "kind": "Number"},
          "range": {"start": 19, "end": 20},
      }
      ent_11 = {
          "entity_kind": "entity_1",
          "value": "ent 1",
          "resolved_value": "entity 1",
          "range": {"start": 13, "end": 18},
      }
      ent_12 = {
          "entity_kind": "entity_2",
          "value": "ent 1",
          "resolved_value": "entity 1",
          "range": {"start": 13, "end": 18},
      }
      num_1 = {
          "entity_kind": "snips/number",
          "value": "1",
          "range": {"start": 23, "end": 24},
          "resolved_value": {"value": 1.0, "kind": "Number"},
      }
  
      expected_data = [
          (u_0, [num_0], [ent_0], []),
          (u_1, [num_1], [ent_11, ent_12], ["cluster_1", "cluster_3"]),
          (u_2, [], [], []),
          (u_3, [], [], ["cluster_2"]),
      ]
  
      self.assertSequenceEqual(expected_data, processed_data)
  
imports: from __future__ import unicode_literals
  import io
  from builtins import str, zip, range
  import numpy
  from checksumdir import dirhash
  from mock import patch, MagicMock
  from snips_nlu.common.io_utils import temp_dir
  from snips_nlu.common.utils import json_string
  from snips_nlu.constants import LANGUAGE_EN, STEMS, WORD_CLUSTERS, STOP_WORDS
  from snips_nlu.dataset import Dataset
  from snips_nlu.entity_parser import BuiltinEntityParser, CustomEntityParser
  from snips_nlu.entity_parser.custom_entity_parser_usage import CustomEntityParserUsage
  from snips_nlu.exceptions import _EmptyDatasetUtterancesError
  from snips_nlu.intent_classifier.featurizer import CooccurrenceVectorizer, Featurizer, TfidfVectorizer
  from snips_nlu.intent_classifier.log_reg_classifier_utils import text_to_utterance
  from snips_nlu.pipeline.configs import FeaturizerConfig
  from snips_nlu.pipeline.configs.intent_classifier import CooccurrenceVectorizerConfig, TfidfVectorizerConfig
  from snips_nlu.tests.utils import FixtureTest, get_empty_dataset, EntityParserMock
label_desc: Use image node_id 4 for calling the TestTfidfVectorizer obj's underlying member method code with example usage: obj.test_preprocess() without return types