Spaces:
Running
Running
Yurii Paniv
commited on
Commit
·
c0a9b4d
1
Parent(s):
87acc2e
Add cases to formatter
Browse files- ukrainian_tts/formatter.py +16 -0
ukrainian_tts/formatter.py
CHANGED
@@ -10,6 +10,22 @@ def preprocess_text(text, use_autostress_model=False):
|
|
10 |
# replace apostrophe
|
11 |
text = text.replace("`", "'")
|
12 |
text = text.replace("ʼ", "'")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
# numbers
|
14 |
text = re.sub(r"(\d)\s+(\d)", r"\1\2", text)
|
15 |
|
|
|
10 |
# replace apostrophe
|
11 |
text = text.replace("`", "'")
|
12 |
text = text.replace("ʼ", "'")
|
13 |
+
text = text.replace("…", "...")
|
14 |
+
|
15 |
+
symbols = {
|
16 |
+
"”": "\"",
|
17 |
+
"“": "\"",
|
18 |
+
"’": "\"",
|
19 |
+
"‘": "\"",
|
20 |
+
"«": "\"",
|
21 |
+
"»": "\"",
|
22 |
+
"–": "-",
|
23 |
+
"—": "-",
|
24 |
+
"―": "-",
|
25 |
+
|
26 |
+
}
|
27 |
+
for symbol in symbols.keys():
|
28 |
+
text = text.replace(symbol, symbols[symbol])
|
29 |
# numbers
|
30 |
text = re.sub(r"(\d)\s+(\d)", r"\1\2", text)
|
31 |
|