Abdurahman
commited on
Commit
•
efdb44e
1
Parent(s):
43ce49e
app
Browse files
util.py
CHANGED
@@ -17,23 +17,16 @@ long_texts = [
|
|
17 |
]
|
18 |
|
19 |
# Front-End Utils
|
|
|
20 |
def generate_short_text(script_choice):
|
21 |
"""Generate a random Uyghur short text based on the type."""
|
22 |
-
ug_arab_to_latn = UgMultiScriptConverter('UAS', 'ULS')
|
23 |
-
|
24 |
text = random.choice(short_texts)
|
25 |
-
if script_choice == "Uyghur Latin"
|
26 |
-
return ug_arab_to_latn(text)
|
27 |
-
return text
|
28 |
|
29 |
def generate_long_text(script_choice):
|
30 |
"""Generate a random Uyghur long text based on the type."""
|
31 |
-
ug_arab_to_latn = UgMultiScriptConverter('UAS', 'ULS')
|
32 |
-
|
33 |
text = random.choice(long_texts)
|
34 |
-
if script_choice == "Uyghur Latin"
|
35 |
-
return ug_arab_to_latn(text)
|
36 |
-
return text
|
37 |
|
38 |
# ASR Utils
|
39 |
# def load_and_resample_audio(audio_data, target_rate):
|
|
|
17 |
]
|
18 |
|
19 |
# Front-End Utils
|
20 |
+
ug_arab_to_latn = UgMultiScriptConverter('UAS', 'ULS')
|
21 |
def generate_short_text(script_choice):
|
22 |
"""Generate a random Uyghur short text based on the type."""
|
|
|
|
|
23 |
text = random.choice(short_texts)
|
24 |
+
return ug_arab_to_latn(text) if script_choice == "Uyghur Latin" else text
|
|
|
|
|
25 |
|
26 |
def generate_long_text(script_choice):
|
27 |
"""Generate a random Uyghur long text based on the type."""
|
|
|
|
|
28 |
text = random.choice(long_texts)
|
29 |
+
return ug_arab_to_latn(text) if script_choice == "Uyghur Latin" else text
|
|
|
|
|
30 |
|
31 |
# ASR Utils
|
32 |
# def load_and_resample_audio(audio_data, target_rate):
|