src/baselines/unifiedqa.py
def normalize_answer(s: str) -> str:
  """Normalize UnifiedQA Generated Text [1]. """
  import re
  import string

  def remove_articles(text):
    return re.sub(r'\b(a|an|the)\b', ' ', text)

  def white_space_fix(text):
    return ' '.join(text.split())

  # Temporary fix for bug where {}^<\` characters roundtrip into \u2047 (??) character
  def fix_buggy_characters(str):
    return re.sub("[{}^\\\\`\u2047<]", " ", str)

  def remove_punc(text):
    exclude = set(string.punctuation)
    return ''.join(ch for ch in text if ch not in exclude)

  return T.pipe(s, str.lower, remove_punc, fix_buggy_characters,
                remove_articles, white_space_fix)
Normalize UnifiedQA Generated Text [1]. 
Normalize UnifiedQA Generated Text [1].
Normalize UnifiedQA Generated Text [ 1 ] .
def normalize_answer(s: str) -> str:
  import re
  import string
  def remove_articles(text):
    return re.sub(r'\b(a|an|the)\b', ' ', text)
  def white_space_fix(text):
    return ' '.join(text.split())
  def fix_buggy_characters(str):
    return re.sub("[{}^\\\\`\u2047<]", " ", str)
  def remove_punc(text):
    exclude = set(string.punctuation)
    return ''.join(ch for ch in text if ch not in exclude)
  return T.pipe(s, str.lower, remove_punc, fix_buggy_characters,
                remove_articles, white_space_fix)
def normalize_answer ( s : str ) -> str : import re import string def remove_articles ( text ) : return re . sub ( r'\b(a|an|the)\b' , ' ' , text ) def white_space_fix ( text ) : return ' ' . join ( text . split ( ) ) def fix_buggy_characters ( str ) : return re . sub ( "[{}^\\\\`\u2047<]" , " " , str ) def remove_punc ( text ) : exclude = set ( string . punctuation ) return '' . join ( ch for ch in text if ch not in exclude ) return T . pipe ( s , str . lower , remove_punc , fix_buggy_characters , remove_articles , white_space_fix )
Normalize UnifiedQA Generated Text [1].
Normalize UnifiedQA Generated Text [ 1 ] .
"""Normalize UnifiedQA Generated Text [1]. """ # Temporary fix for bug where {}^<\` characters roundtrip into \u2047 (??) character
s
str