Spaces:
Running
on
T4
Running
on
T4
Create new file
Browse files- text/cleaners.py +12 -0
text/cleaners.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re
|
2 |
+
|
3 |
+
def japanese_cleaners(text):
|
4 |
+
from text.japanese import japanese_to_romaji_with_accent
|
5 |
+
text = japanese_to_romaji_with_accent(text)
|
6 |
+
if len(text) == 0 or re.match('[A-Za-z]', text[-1]):
|
7 |
+
text += '.'
|
8 |
+
return text
|
9 |
+
|
10 |
+
|
11 |
+
def japanese_cleaners2(text):
|
12 |
+
return japanese_cleaners(text).replace('ts', 'ʦ').replace('...', '…')
|