code: def test_count_vector_featurizer_persist_load(
      create_featurizer: Callable[..., CountVectorsFeaturizer],
      load_featurizer: Callable[..., CountVectorsFeaturizer],
      whitespace_tokenizer: WhitespaceTokenizer,
  ):
      # set non default values to config
      config = {
          "analyzer": "char",
          "strip_accents": "ascii",
          "stop_words": "stop",
          "min_df": 2,
          "max_df": 3,
          "min_ngram": 2,
          "max_ngram": 3,
          "max_features": 10,
          "lowercase": False,
      }
      train_ftr = create_featurizer(config)
  
      sentence1 = "ababab 123 13xc лаомтгцу sfjv oö aà"
      sentence2 = "abababalidcn 123123 13xcdc лаомтгцу sfjv oö aà"
  
      train_message1 = Message(data={TEXT: sentence1})
      train_message2 = Message(data={TEXT: sentence2})
      whitespace_tokenizer.process([train_message1])
      whitespace_tokenizer.process([train_message2])
  
      data = TrainingData([train_message1, train_message2])
      train_ftr.train(data)
      train_ftr.process_training_data(data)
  
      # persist featurizer
      train_vect_params = {
          attribute: vectorizer.get_params()
          for attribute, vectorizer in train_ftr.vectorizers.items()
      }
  
      # add trained vocabulary to vectorizer params
      for attribute, attribute_vect_params in train_vect_params.items():
          if hasattr(train_ftr.vectorizers[attribute], "vocabulary_"):
              train_vect_params[attribute].update(
                  {
                      "vocabulary": train_ftr.vectorizers[
                          attribute
                      ].vocabulary_
                  }
              )
  
      test_ftr = load_featurizer(config)
      test_vect_params = {
          attribute: vectorizer.get_params()
          for attribute, vectorizer in test_ftr.vectorizers.items()
      }
  
      assert train_vect_params == test_vect_params
  
      # check if vocaculary was loaded correctly
      assert hasattr(test_ftr.vectorizers[TEXT], "vocabulary_")
  
      test_message1 = Message(data={TEXT: sentence1})
      whitespace_tokenizer.process([test_message1])
      test_ftr.process([test_message1])
      test_message2 = Message(data={TEXT: sentence2})
      whitespace_tokenizer.process([test_message2])
      test_ftr.process([test_message2])
  
      (
          test_seq_vec_1,
          test_sen_vec_1,
      ) = test_message1.get_sparse_features(TEXT, [])
      if test_seq_vec_1:
          test_seq_vec_1 = test_seq_vec_1.features
      if test_sen_vec_1:
          test_sen_vec_1 = test_sen_vec_1.features
      (
          train_seq_vec_1,
          train_sen_vec_1,
      ) = train_message1.get_sparse_features(TEXT, [])
      if train_seq_vec_1:
          train_seq_vec_1 = train_seq_vec_1.features
      if train_sen_vec_1:
          train_sen_vec_1 = train_sen_vec_1.features
      (
          test_seq_vec_2,
          test_sen_vec_2,
      ) = test_message2.get_sparse_features(TEXT, [])
      if test_seq_vec_2:
          test_seq_vec_2 = test_seq_vec_2.features
      if test_sen_vec_2:
          test_sen_vec_2 = test_sen_vec_2.features
      (
          train_seq_vec_2,
          train_sen_vec_2,
      ) = train_message2.get_sparse_features(TEXT, [])
      if train_seq_vec_2:
          train_seq_vec_2 = train_seq_vec_2.features
      if train_sen_vec_2:
          train_sen_vec_2 = train_sen_vec_2.features
  
      # check that train features and test features after loading are the same
      assert np.all(
          test_seq_vec_1.toarray() == train_seq_vec_1.toarray()
      )
      assert np.all(
          test_sen_vec_1.toarray() == train_sen_vec_1.toarray()
      )
      assert np.all(
          test_seq_vec_2.toarray() == train_seq_vec_2.toarray()
      )
      assert np.all(
          test_sen_vec_2.toarray() == train_sen_vec_2.toarray()
      )
  
imports: from typing import List, Any, Text, Dict, Callable, Optional
  import dataclasses
  import numpy
  import pytest
  import scipy.sparse
  from rasa.engine.graph import ExecutionContext
  from rasa.engine.storage.resource import Resource
  from rasa.engine.storage.storage import ModelStorage
  from rasa.nlu.tokenizers.spacy_tokenizer import SpacyTokenizer
  from rasa.nlu.tokenizers.whitespace_tokenizer import WhitespaceTokenizer
  from rasa.nlu.constants import TOKENS_NAMES, SPACY_DOCS
  from rasa.nlu.utils.spacy_utils import SpacyModel
  from rasa.shared.nlu.constants import TEXT, INTENT, RESPONSE, ACTION_TEXT, ACTION_NAME
  from rasa.nlu.tokenizers.tokenizer import Token
  from rasa.shared.nlu.training_data.training_data import TrainingData
  from rasa.shared.nlu.training_data.message import Message
  from rasa.nlu.featurizers.sparse_featurizer.count_vectors_featurizer import CountVectorsFeaturizer
label_desc: Use image node_id 11 for calling a global function with example usage: test_count_vector_featurizer_persist_load(create_featurizer, load_featurizer, whitespace_tokenizer) without return types