hexgrad commited on
Commit
a710a8c
·
verified ·
1 Parent(s): 9fd8716

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -89,7 +89,8 @@ def normalize(text):
89
  text = re.sub(r'(?<=\d),(?=\d)', '', text)
90
  text = re.sub(r'(?<=\d)-(?=\d)', ' to ', text) # TODO: could be minus
91
  text = re.sub(r'(?<=\d)S', ' S', text)
92
- text = re.sub(r"(?<=[A-Z])'?s", lambda m: "'s" if m.group()[0] == 'X' else "'S", text)
 
93
  text = re.sub(r'(?:[A-Za-z]\.){2,} [a-z]', lambda m: m.group().replace('.', '-'), text)
94
  text = re.sub(r'(?i)(?<=[A-Z])\.(?=[A-Z])', '-', text)
95
  return parens_to_angles(text).strip()
 
89
  text = re.sub(r'(?<=\d),(?=\d)', '', text)
90
  text = re.sub(r'(?<=\d)-(?=\d)', ' to ', text) # TODO: could be minus
91
  text = re.sub(r'(?<=\d)S', ' S', text)
92
+ text = re.sub(r"(?<=[A-Z])'?s\b", "'S", text)
93
+ text = re.sub(r"(?<=X')S\b", 's', text)
94
  text = re.sub(r'(?:[A-Za-z]\.){2,} [a-z]', lambda m: m.group().replace('.', '-'), text)
95
  text = re.sub(r'(?i)(?<=[A-Z])\.(?=[A-Z])', '-', text)
96
  return parens_to_angles(text).strip()