mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-10-07 23:48:48 +08:00
Add Lang Support
This commit is contained in:
parent
f6ffb7b619
commit
5953bc77f9
@ -264,8 +264,11 @@ def get_phones_and_bert(text,language):
|
|||||||
return get_phones_and_bert(formattext,"zh")
|
return get_phones_and_bert(formattext,"zh")
|
||||||
else:
|
else:
|
||||||
phones, word2ph, norm_text = clean_text_inf(formattext, language)
|
phones, word2ph, norm_text = clean_text_inf(formattext, language)
|
||||||
|
|
||||||
bert = get_bert_feature(norm_text, word2ph).to(device)
|
bert = get_bert_feature(norm_text, word2ph).to(device)
|
||||||
|
elif language == "yue" and re.search(r'[A-Za-z]', formattext):
|
||||||
|
formattext = re.sub(r'[a-z]', lambda x: x.group(0).upper(), formattext)
|
||||||
|
formattext = chinese.text_normalize(formattext)
|
||||||
|
return get_phones_and_bert(formattext,"yue")
|
||||||
else:
|
else:
|
||||||
phones, word2ph, norm_text = clean_text_inf(formattext, language)
|
phones, word2ph, norm_text = clean_text_inf(formattext, language)
|
||||||
bert = torch.zeros(
|
bert = torch.zeros(
|
||||||
|
@ -6,6 +6,7 @@ import cn2an
|
|||||||
|
|
||||||
from pyjyutping import jyutping
|
from pyjyutping import jyutping
|
||||||
from text.symbols import punctuation
|
from text.symbols import punctuation
|
||||||
|
from text.zh_normalization.text_normlization import TextNormalizer
|
||||||
|
|
||||||
normalizer = lambda x: cn2an.transform(x, "an2cn")
|
normalizer = lambda x: cn2an.transform(x, "an2cn")
|
||||||
|
|
||||||
@ -106,9 +107,13 @@ def replace_punctuation(text):
|
|||||||
|
|
||||||
|
|
||||||
def text_normalize(text):
|
def text_normalize(text):
|
||||||
text = normalizer(text)
|
tx = TextNormalizer()
|
||||||
text = replace_punctuation(text)
|
sentences = tx.normalize(text)
|
||||||
return text
|
dest_text = ""
|
||||||
|
for sentence in sentences:
|
||||||
|
dest_text += replace_punctuation(sentence)
|
||||||
|
return dest_text
|
||||||
|
|
||||||
|
|
||||||
punctuation_set=set(punctuation)
|
punctuation_set=set(punctuation)
|
||||||
def jyuping_to_initials_finals_tones(jyuping_syllables):
|
def jyuping_to_initials_finals_tones(jyuping_syllables):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user