code: def test_vocabulary_expand_for_finetuning(
      create_featurizer: Callable[..., RegexFeaturizer],
      default_model_storage: ModelStorage,
      resource: Resource,
      default_execution_context: ExecutionContext,
      whitespace_tokenizer: WhitespaceTokenizer,
  ):
      patterns = [
          {"pattern": "[0-9]+", "name": "number", "usage": "intent"},
          {"pattern": "\\bhey*", "name": "hello", "usage": "intent"},
      ]
  
      featurizer = create_featurizer()
  
      sentence = "hey hey 2020"
      message = Message(data={TEXT: sentence})
      message.set(RESPONSE, sentence)
      message.set(INTENT, "intent")
      training_data = TrainingData([message], regex_features=patterns)
  
      whitespace_tokenizer.process_training_data(training_data)
  
      featurizer.train(training_data)
      featurizer.process_training_data(training_data)
  
      # Test featurization of message
      expected = np.array([1, 0])
      expected_cls = np.array([1, 1])
      seq_vecs, sen_vec = message.get_sparse_features(TEXT, [])
      if seq_vecs:
          seq_vecs = seq_vecs.features
      if sen_vec:
          sen_vec = sen_vec.features
  
      assert (3, 2) == seq_vecs.shape
      assert (1, 2) == sen_vec.shape
      assert np.all(seq_vecs.toarray()[0] == expected)
      assert np.all(sen_vec.toarray()[-1] == expected_cls)
  
      loaded_featurizer = RegexFeaturizer.load(
          RegexFeaturizer.get_default_config(),
          default_model_storage,
          resource,
          dataclasses.replace(
              default_execution_context, is_finetuning=True
          ),
      )
  
      new_patterns = [
          {"pattern": "\\btoday*", "name": "day", "usage": "intent"},
          {"pattern": "\\bhey+", "name": "hello", "usage": "intent"},
      ]
      new_sentence = "hey today"
      message = Message(data={TEXT: new_sentence})
      message.set(RESPONSE, new_sentence)
      message.set(INTENT, "intent")
      new_training_data = TrainingData(
          [message], regex_features=patterns + new_patterns
      )
  
      whitespace_tokenizer.process_training_data(new_training_data)
  
      loaded_featurizer.train(new_training_data)
      loaded_featurizer.process_training_data(new_training_data)
  
      # Test featurization of message, this time for the extra pattern as well.
      expected_token_1 = np.array([1, 0, 0])
      expected_token_2 = np.array([0, 0, 1])
      expected_cls = np.array([1, 0, 1])
  
      seq_vecs, sen_vec = message.get_sparse_features(TEXT, [])
      if seq_vecs:
          seq_vecs = seq_vecs.features
      if sen_vec:
          sen_vec = sen_vec.features
  
      assert (2, 3) == seq_vecs.shape
      assert (1, 3) == sen_vec.shape
      assert np.all(seq_vecs.toarray()[0] == expected_token_1)
      assert np.all(seq_vecs.toarray()[1] == expected_token_2)
      assert np.all(sen_vec.toarray()[-1] == expected_cls)
  
      # let's check if the order of patterns is preserved
      for old_index, pattern in enumerate(featurizer.known_patterns):
          assert (
              pattern["name"]
              == loaded_featurizer.known_patterns[old_index]["name"]
          )
  
      # we also modified a pattern, check if that is correctly modified
      pattern_to_check = [
          pattern
          for pattern in loaded_featurizer.known_patterns
          if pattern["name"] == "hello"
      ]
      assert pattern_to_check == [new_patterns[1]]
  
imports: from typing import Text, List, Any, Tuple, Callable, Dict, Optional
  import dataclasses
  import numpy
  import pytest
  from rasa.engine.graph import ExecutionContext
  from rasa.engine.storage.resource import Resource
  from rasa.engine.storage.storage import ModelStorage
  from rasa.nlu.featurizers.sparse_featurizer.regex_featurizer import RegexFeaturizer
  from rasa.shared.nlu.training_data.training_data import TrainingData
  from rasa.shared.nlu.training_data.message import Message
  from rasa.nlu.tokenizers.whitespace_tokenizer import WhitespaceTokenizer
  from rasa.nlu.constants import SPACY_DOCS, TOKENS_NAMES
  from rasa.shared.nlu.constants import TEXT, INTENT, RESPONSE
  from rasa.nlu.tokenizers.spacy_tokenizer import SpacyTokenizer
label_desc: Use image node_id 11 for calling a global function with example usage: test_vocabulary_expand_for_finetuning(create_featurizer, default_model_storage, resource, default_execution_context, whitespace_tokenizer) without return types