Spaces:
Running
Running
Yurii Paniv
commited on
Commit
•
5d459a9
1
Parent(s):
d8e8c6b
Handle numbers
Browse files- app.py +1 -1
- crh_preprocessor/preprocessor.py +16 -0
app.py
CHANGED
@@ -71,7 +71,7 @@ iface = gr.Interface(
|
|
71 |
],
|
72 |
outputs=[
|
73 |
gr.components.Audio(label="Output"),
|
74 |
-
gr.components.Textbox(label="
|
75 |
],
|
76 |
title="Кримськотатарський синтез мовлення",
|
77 |
description="Кримськотатарський Text-to-Speech за допомогою Coqui TTS",
|
|
|
71 |
],
|
72 |
outputs=[
|
73 |
gr.components.Audio(label="Output"),
|
74 |
+
gr.components.Textbox(label="Оброблений текст"),
|
75 |
],
|
76 |
title="Кримськотатарський синтез мовлення",
|
77 |
description="Кримськотатарський Text-to-Speech за допомогою Coqui TTS",
|
crh_preprocessor/preprocessor.py
CHANGED
@@ -11,5 +11,21 @@ def preprocess(text):
|
|
11 |
for mapping in mappings:
|
12 |
text = re.sub(mapping[0], mapping[1], text)
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
return text[1:-1]
|
15 |
|
|
|
11 |
for mapping in mappings:
|
12 |
text = re.sub(mapping[0], mapping[1], text)
|
13 |
|
14 |
+
numbers = {
|
15 |
+
"0": "sıfır",
|
16 |
+
"1": "bir",
|
17 |
+
"2": "eki",
|
18 |
+
"3": "üç",
|
19 |
+
"4": "dört",
|
20 |
+
"5": "beş",
|
21 |
+
"6": "altı",
|
22 |
+
"7": "yedi",
|
23 |
+
"8": "sekiz",
|
24 |
+
"9": "doquz",
|
25 |
+
}
|
26 |
+
|
27 |
+
for number in numbers.keys():
|
28 |
+
text = text.replace(number, numbers[number] + " ")
|
29 |
+
|
30 |
return text[1:-1]
|
31 |
|