code: def has_answer(answers, text, tokenizer, match_type) -> bool:
      """
      Check if a document contains an answer string.
      If `match_type` is string, token matching is done between the text
          and answer.
      If `match_type` is regex, we search the whole text with the regex.
      """
      text = _normalize(text)
  
      if match_type == "string":
          # Answer is a list of possible strings
          text = tokenizer.tokenize(text).words(uncased=True)
  
          for single_answer in answers:
              single_answer = _normalize(single_answer)
              single_answer = tokenizer.tokenize(single_answer)
              single_answer = single_answer.words(uncased=True)
  
              for i in range(0, len(text) - len(single_answer) + 1):
                  if single_answer == text[i : i + len(single_answer)]:
                      return True
  
      elif match_type == "regex":
          # Answer is a regex
          for single_answer in answers:
              single_answer = _normalize(single_answer)
              if regex_match(text, single_answer):
                  return True
      return False
  
file_path: megatron-lm/tasks/orqa/unsupervised/qa_utils.py
imports: import collections
  import logging
  import string
  import unicodedata
  from functools import partial
  from multiprocessing import Pool
  from typing import Tuple, List, Dict
  import regex
  from tasks.orqa.unsupervised.tokenizers import SimpleTokenizer
label_desc: Use image node_id 3 for calling a global function with example usage: has_answer(answers, text, tokenizer, match_type) and returns: False, True, True