Spaces:
Running
on
Zero
Running
on
Zero
Upload app.py
Browse files
app.py
CHANGED
@@ -49,8 +49,7 @@ def split_num(num):
|
|
49 |
num = num.group()
|
50 |
if '.' in num:
|
51 |
a, b = num.split('.')
|
52 |
-
|
53 |
-
return f'{a} point {b}'
|
54 |
assert num.isdigit() and len(num) == 4, num
|
55 |
year = int(num)
|
56 |
if year < 1100 or year % 1000 < 10:
|
@@ -99,7 +98,9 @@ def phonemize(text, voice, norm=True):
|
|
99 |
# TODO: Custom phonemization rules?
|
100 |
ps = parens_to_angles(ps)
|
101 |
# https://en.wiktionary.org/wiki/kokoro#English
|
102 |
-
|
|
|
|
|
103 |
ps = ''.join(filter(lambda p: p in VOCAB, ps))
|
104 |
if lang == 'j' and any(p in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' for p in ps):
|
105 |
gr.Warning('Japanese tokenizer does not handle English letters.')
|
|
|
49 |
num = num.group()
|
50 |
if '.' in num:
|
51 |
a, b = num.split('.')
|
52 |
+
return ' point '.join([a, ' '.join(b)])
|
|
|
53 |
assert num.isdigit() and len(num) == 4, num
|
54 |
year = int(num)
|
55 |
if year < 1100 or year % 1000 < 10:
|
|
|
98 |
# TODO: Custom phonemization rules?
|
99 |
ps = parens_to_angles(ps)
|
100 |
# https://en.wiktionary.org/wiki/kokoro#English
|
101 |
+
if lang in 'ab':
|
102 |
+
ps = ps.replace('kəkˈoːɹoʊ', 'kˈoʊkəɹoʊ').replace('kəkˈɔːɹəʊ', 'kˈəʊkəɹəʊ')
|
103 |
+
ps = ps.replace('ʲ', 'j').replace('r', 'ɹ').replace('x', 'k')
|
104 |
ps = ''.join(filter(lambda p: p in VOCAB, ps))
|
105 |
if lang == 'j' and any(p in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' for p in ps):
|
106 |
gr.Warning('Japanese tokenizer does not handle English letters.')
|