code: def _get_final_text(pred_text, orig_text):
      def _strip_spaces(text):
          ns_text = ""
          ns_to_s_map = OrderedDict()
          for i, c in enumerate(text):
              if c == " ":
                  continue
              ns_to_s_map[len(ns_text)] = i
              ns_text += c
          return ns_text, ns_to_s_map
  
      orig_tokens = _clean_text(orig_text).strip().split()
      split_tokens = []
      for token in orig_tokens:
          if token not in (
              "[UNK]",
              "[SEP]",
              "[PAD]",
              "[CLS]",
              "[MASK]",
          ):
              token = token.lower()
              token = _run_strip_accents(token)
          split_tokens.extend(_run_split_on_punc(token))
  
      tok_text = " ".join(" ".join(split_tokens).strip().split())
      start_position = tok_text.find(pred_text)
      if start_position == -1:
          return orig_text
      end_position = start_position + len(pred_text) - 1
  
      orig_ns_text, orig_ns_to_s_map = _strip_spaces(orig_text)
      tok_ns_text, tok_ns_to_s_map = _strip_spaces(tok_text)
      if len(orig_ns_text) != len(tok_ns_text):
          return orig_text
      tok_s_to_ns_map = {v: k for k, v in tok_ns_to_s_map.items()}
  
      orig_start_position = None
      if start_position in tok_s_to_ns_map:
          if (
              ns_start_position := tok_s_to_ns_map[start_position]
          ) in orig_ns_to_s_map:
              orig_start_position = orig_ns_to_s_map[ns_start_position]
      if orig_start_position is None:
          return orig_text
  
      orig_end_position = None
      if end_position in tok_s_to_ns_map:
          if (
              ns_end_position := tok_s_to_ns_map[end_position]
          ) in orig_ns_to_s_map:
              orig_end_position = orig_ns_to_s_map[ns_end_position]
      if orig_end_position is None:
          return orig_text
  
      output_text = orig_text[
          orig_start_position : (orig_end_position + 1)
      ]
      return output_text
  
file_path: tinygrad/examples/mlperf/helpers.py
imports: from collections import OrderedDict
  import unicodedata
  import numpy
  from scipy import signal
label_desc: Use image node_id 11 for calling a global function with example usage: _get_final_text(pred_text, orig_text) and returns: output_text, ns_text,  ns_to_s_map, orig_text, orig_text, orig_text, orig_text