support yue and ko inference

support yue and ko inference
This commit is contained in:
KamioRinn
2024-08-03 11:19:52 +08:00
committed by GitHub
parent 23a4edffec
commit 6ec3a66d53
2 changed files with 32 additions and 17 deletions

View File

@@ -6,6 +6,7 @@ import cn2an
from pyjyutping import jyutping
from text.symbols import punctuation
from text.zh_normalization.text_normlization import TextNormalizer
normalizer = lambda x: cn2an.transform(x, "an2cn")
@@ -106,9 +107,13 @@ def replace_punctuation(text):
def text_normalize(text):
text = normalizer(text)
text = replace_punctuation(text)
return text
tx = TextNormalizer()
sentences = tx.normalize(text)
dest_text = ""
for sentence in sentences:
dest_text += replace_punctuation(sentence)
return dest_text
punctuation_set=set(punctuation)
def jyuping_to_initials_finals_tones(jyuping_syllables):