code: def _generate_lookup_regex(
      lookup_table: Dict[Text, Union[Text, List[Text]]],
      use_word_boundaries: bool = True,
  ) -> Text:
      r"""Creates a regex pattern from the given lookup table.
  
      The lookup table is either a file or a list of entries.
  
      Args:
          lookup_table: The lookup table.
          use_word_boundaries: If True add `\b` around the regex expression
            for each lookup table expressions.
  
      Returns:
          The regex pattern.
      """
      lookup_elements = lookup_table["elements"]
  
      # if it's a list, it should be the elements directly
      if isinstance(lookup_elements, list):
          elements_to_regex = lookup_elements
      # otherwise it's a file path.
      else:
          elements_to_regex = read_lookup_table_file(lookup_elements)
  
      # sanitize the regex, escape special characters
      elements_sanitized = [re.escape(e) for e in elements_to_regex]
  
      if use_word_boundaries:
          # regex matching elements with word boundaries on either side
          return "(\\b" + "\\b|\\b".join(elements_sanitized) + "\\b)"
      else:
          return "(" + "|".join(elements_sanitized) + ")"
  
file_path: rasa/rasa/nlu/utils/pattern_utils.py
imports: import re
  from typing import Dict, List, Text, Union
  import rasa.shared.utils.io
  from rasa.shared.nlu.training_data.training_data import TrainingData
  from rasa.shared.exceptions import InvalidConfigException
label_desc: Use image node_id 2 for calling a global function with example usage: _generate_lookup_regex(lookup_table, use_word_boundaries) and returns: unknown, unknown