docstr: CTCScore uses Refs + reference free things differently, so take care for that.
code: def score_data(
      self, exs: List[Example], want_ref_types=List[UseRef]
  ) -> Dict[UseRef, Dict[str, List[float]]]:
      """
      CTCScore uses Refs + reference free things differently, so take care for that.
      """
      assert len(exs) > 0
      result = {}
  
      # CTC Score is not robust to lots of formatting things, so fix that
      def _fix_text(x: Example):
          def _fix(t):
              if (
                  t is None
              ):  # dataset without reference; don't worry about it
                  return t
              if (
                  t == ""
              ):  # hypos sometimes empty cause of perturbations that remove things
                  return "EMPTY"
              t = t.replace("\n", " ")  # tokenization
              t = re.sub(
                  r"<U\+([0-9a-fA-F]{4,6})>",
                  lambda x: chr(int(x.group(1), 16)),
                  t,
              )  # not happy with unicode
              t = t.replace(
                  "\u00a0", " "
              )  # ... yup (non breaking space)
              t = t.replace("\t", " ")  # woooooow.
              return t
  
          x.hypo = _fix(x.hypo)
          x.context = _fix(x.context)
          x.ref = _fix(x.ref)
          return x
  
      exs = [_fix_text(x) for x in exs]
  
      if UseRef.NO in want_ref_types:
          result[UseRef.NO] = {
              CTC_RELEVANCE_SUMMARY: [
                  self.scorer.score_relevance(
                      doc=x.context,
                      refs=[
                          x.context
                      ],  # use context for ref since need to fill + this makes sense with underlying code
                      hypo=x.hypo,
                      remove_stopwords=False,  # same as default in CTC code
                  )
                  for x in exs
              ],
              CTC_CONSISTENCY_SUMMARY: [
                  self.scorer.score_consistency(
                      doc=x.context,
                      refs=[],  # unused in underlying code for this
                      hypo=x.hypo,
                      remove_stopwords=False,  # same as default in CTC code
                  )
                  for x in exs
              ],
          }
      if UseRef.YES in want_ref_types and exs[0].ref is not None:
          result[UseRef.YES] = {
              CTC_RELEVANCE_SUMMARY: [
                  self.scorer.score_relevance(
                      doc=x.context,
                      refs=[x.ref],
                      hypo=x.hypo,
                      remove_stopwords=False,  # same as default in CTC code
                  )
                  for x in exs
              ],
              CTC_CONSISTENCY_SUMMARY: [
                  self.scorer.score_consistency(
                      doc=x.ref,
                      refs=[],  # unused in underlying code for this
                      hypo=x.hypo,
                      remove_stopwords=False,  # same as default in CTC code
                  )
                  for x in exs
              ],
          }
  
      return result
  
imports: from typing import Dict, List
  from projects.roscoe.baselines.constants import BARTSCORE_CNN_F, BARTSCORE_CNN_PARA_F, BARTSCORE_F, BARTSCORE_FINETUNED_F, BERTSCORE_F, BLEURT, CTC_CONSISTENCY_SUMMARY, CTC_RELEVANCE_SUMMARY, PRISM_AVG, ROUGE_L, ROUGE_2, ROUGE_1, Example, ScoreMe, UseRef
  import re
  from importlib.machinery import SourceFileLoader
label_desc: Use image node_id 2 for calling the CTCSummaryBaselineScorer obj's underlying member method code with example usage: obj.score_data(exs, want_ref_types) and returns: result, x, t, t, str