Create english_patch.py
Browse files- english_patch.py +16 -0
english_patch.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# english_patch.py
|
| 2 |
+
import melo.text.english as eng
|
| 3 |
+
|
| 4 |
+
orig_g2p = eng.g2p
|
| 5 |
+
|
| 6 |
+
def patched_g2p(text):
|
| 7 |
+
phones, tones, word2ph = orig_g2p(text)
|
| 8 |
+
fixed_word2ph = []
|
| 9 |
+
for aaa in word2ph:
|
| 10 |
+
if isinstance(aaa, int):
|
| 11 |
+
fixed_word2ph.append(aaa)
|
| 12 |
+
else:
|
| 13 |
+
fixed_word2ph += aaa
|
| 14 |
+
return phones, tones, fixed_word2ph
|
| 15 |
+
|
| 16 |
+
eng.g2p = patched_g2p
|