code: def test_lookup_with_and_without_boundaries(
      sentence: Text,
      expected_sequence_features: List[List[float]],
      expected_sentence_features: List[float],
      labeled_tokens: List[float],
      use_word_boundaries: bool,
      spacy_nlp: Any,
      create_featurizer: Callable[..., RegexFeaturizer],
      spacy_tokenizer: SpacyTokenizer,
  ):
      ftr = create_featurizer(
          {"use_word_boundaries": use_word_boundaries}
      )
      training_data = TrainingData()
  
      # we use lookups because the "use_word_boundaries" flag is only used when
      # producing patterns from lookup tables
      lookups = [{"name": "how", "elements": ["how"]}]
      training_data.lookup_tables = lookups
      ftr.train(training_data)
  
      # adds tokens to the message
      message = Message(data={TEXT: sentence})
      message.set(SPACY_DOCS[TEXT], spacy_nlp(sentence))
      spacy_tokenizer.process([message])
  
      (
          sequence_features,
          sentence_features,
      ) = ftr._features_for_patterns(message, TEXT)
  
      sequence_features = sequence_features.toarray()
      sentence_features = sentence_features.toarray()
      num_of_patterns = sum(
          [len(lookup["elements"]) for lookup in lookups]
      )
      assert sequence_features.shape == (
          len(message.get(TOKENS_NAMES[TEXT])),
          num_of_patterns,
      )
      num_of_lookup_tables = len(lookups)
      assert sentence_features.shape == (
          num_of_lookup_tables,
          num_of_patterns,
      )
  
      # sequence_features should be {0,1} for each token: 1 if match, 0 if not
      assert np.allclose(
          sequence_features, expected_sequence_features, atol=1e-10
      )
      # sentence_features should be {0,1} for each lookup table: 1 if sentence
      # contains match from that table, 0 if not
      assert np.allclose(
          sentence_features, expected_sentence_features, atol=1e-10
      )
  
      # the tokenizer should have added tokens
      assert len(message.get(TOKENS_NAMES[TEXT], [])) > 0
  
      # the number of regex matches on each token should match
      for i, token in enumerate(message.get(TOKENS_NAMES[TEXT])):
          token_matches = token.get("pattern").values()
          num_matches = sum(token_matches)
          # labeled_tokens should list the token(s) which match a pattern
          assert num_matches == labeled_tokens.count(i)
  
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 9 for calling a global function with example usage: test_lookup_with_and_without_boundaries(sentence, expected_sequence_features, expected_sentence_features, labeled_tokens, use_word_boundaries, spacy_nlp, create_featurizer, spacy_tokenizer) without return types