code: def _words_match_regex(
      words: List[str], ignore_case=False, replace_white_space=False
  ) -> Pattern:
      """Obtain the regex that finds whether a given corpus contains any word in the input words
  
      Parameters
      ----------
      words
  
      Returns
      -------
      regex
  
      """
      words = [ele for ele in words if ele]
      if ignore_case:
          flags = re.IGNORECASE
      else:
          flags = 0
      if replace_white_space:
          words = [ele.replace(" ", r"\s+") for ele in words]
      regex = re.compile(
          "[^a-z]({words})[^a-z]|^({words})$|^({words})[^a-z]|[^a-z]({words})$".format(
              words="|".join(words)
          ),
          flags,
      )
      return regex
  
imports: import re
  import regex
  import requests
  import unicodedata
  import os
  import warnings
  from typing import List, Pattern, Union, Tuple, Optional
  from sacremoses.normalize import MosesPunctNormalizer
  from ..utils.lazy_imports import try_import_fasttext, try_import_langid
  from ..utils.misc import download
  from ..base import get_model_zoo_home_dir, get_repo_url
label_desc: Use image node_id 1 for calling a global function with example usage: _words_match_regex(words, ignore_case, replace_white_space) and returns: regex