mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-04-06 03:57:44 +08:00
Update chinese.py
This commit is contained in:
parent
383df7ed4a
commit
bdcbc46cb0
@ -5,13 +5,11 @@ import re
|
|||||||
import cn2an
|
import cn2an
|
||||||
from pypinyin import lazy_pinyin, Style
|
from pypinyin import lazy_pinyin, Style
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
sys.path.append("/data/docker/liujing04/gpt-vits/gpt-vits-master")
|
|
||||||
|
|
||||||
from text.symbols import punctuation
|
from text.symbols import punctuation
|
||||||
from text.tone_sandhi import ToneSandhi
|
from text.tone_sandhi import ToneSandhi
|
||||||
|
|
||||||
|
normalizer = lambda x: cn2an.transform(x, "an2cn")
|
||||||
|
|
||||||
current_file_path = os.path.dirname(__file__)
|
current_file_path = os.path.dirname(__file__)
|
||||||
pinyin_to_symbol_map = {
|
pinyin_to_symbol_map = {
|
||||||
line.split("\t")[0]: line.strip().split("\t")[1]
|
line.split("\t")[0]: line.strip().split("\t")[1]
|
||||||
@ -151,10 +149,8 @@ def _g2p(segments):
|
|||||||
|
|
||||||
|
|
||||||
def text_normalize(text):
|
def text_normalize(text):
|
||||||
numbers = re.findall(r"\d+(?:\.?\d+)?", text)
|
dest_text=normalizer(text)
|
||||||
for number in numbers:
|
text = replace_punctuation(dest_text)
|
||||||
text = text.replace(number, cn2an.an2cn(number), 1)
|
|
||||||
text = replace_punctuation(text)
|
|
||||||
|
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user