updated chinese cleaners
This commit is contained in:
+12
-6
@@ -29,13 +29,19 @@ def korean_cleaners(text):
|
|||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
# def chinese_cleaners(text):
|
||||||
|
# '''Pipeline for Chinese text'''
|
||||||
|
# text = number_to_chinese(text)
|
||||||
|
# text = chinese_to_bopomofo(text)
|
||||||
|
# text = latin_to_bopomofo(text)
|
||||||
|
# text = re.sub(r'([ˉˊˇˋ˙])$', r'\1。', text)
|
||||||
|
# return text
|
||||||
|
|
||||||
def chinese_cleaners(text):
|
def chinese_cleaners(text):
|
||||||
'''Pipeline for Chinese text'''
|
from pypinyin import Style, pinyin
|
||||||
text = number_to_chinese(text)
|
|
||||||
text = chinese_to_bopomofo(text)
|
phones = [phone[0] for phone in pinyin(text, style=Style.TONE3)]
|
||||||
text = latin_to_bopomofo(text)
|
return ' '.join(phones)
|
||||||
text = re.sub(r'([ˉˊˇˋ˙])$', r'\1。', text)
|
|
||||||
return text
|
|
||||||
|
|
||||||
|
|
||||||
def zh_ja_mixture_cleaners(text):
|
def zh_ja_mixture_cleaners(text):
|
||||||
|
|||||||
Reference in New Issue
Block a user