Spaces:
Running
on
Zero
Running
on
Zero
Upload app.py
Browse files
app.py
CHANGED
@@ -30,10 +30,12 @@ def parens_to_angles(s):
|
|
30 |
|
31 |
def normalize(text):
|
32 |
# TODO: Custom text normalization rules?
|
33 |
-
text =
|
34 |
-
text =
|
35 |
-
text =
|
36 |
-
text =
|
|
|
|
|
37 |
text = text.replace(chr(8216), "'").replace(chr(8217), "'")
|
38 |
text = text.replace(chr(8220), '"').replace(chr(8221), '"')
|
39 |
text = re.sub(r'[^\S \n]', ' ', text)
|
|
|
30 |
|
31 |
def normalize(text):
|
32 |
# TODO: Custom text normalization rules?
|
33 |
+
text = re.sub(r'D[Rr]\.(?= [A-Z])', 'Doctor', text)
|
34 |
+
text = re.sub(r'Mr\.|MR\.(?= [A-Z])', 'Mister', text)
|
35 |
+
text = re.sub(r'Ms\.|MS\.(?= [A-Z])', 'Miss', text)
|
36 |
+
text = re.sub(r'Mrs\.|MRS\.(?= [A-Z])', 'Mrs', text)
|
37 |
+
text = re.sub(r'etc\.(?! [A-Z])', 'etc', text)
|
38 |
+
text = re.sub(r'\b([Yy])eah\b', r"\1e'a", text)
|
39 |
text = text.replace(chr(8216), "'").replace(chr(8217), "'")
|
40 |
text = text.replace(chr(8220), '"').replace(chr(8221), '"')
|
41 |
text = re.sub(r'[^\S \n]', ' ', text)
|