mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-09-29 08:49:59 +08:00
为中文添加了货币计数
This commit is contained in:
parent
11aa78bd9b
commit
82b458625d
@ -10,6 +10,7 @@ import os
|
||||
from text import symbols as symbols_v1
|
||||
from text import symbols2 as symbols_v2
|
||||
|
||||
|
||||
special = [
|
||||
# ("%", "zh", "SP"),
|
||||
("¥", "zh", "SP2"),
|
||||
@ -17,7 +18,6 @@ special = [
|
||||
# ('@', 'zh', "SP4")#不搞鬼畜了,和第二版保持一致吧
|
||||
]
|
||||
|
||||
|
||||
def clean_text(text, language, version=None):
|
||||
if version is None:
|
||||
version = os.environ.get("version", "v2")
|
||||
@ -31,6 +31,14 @@ def clean_text(text, language, version=None):
|
||||
if language not in language_module_map:
|
||||
language = "en"
|
||||
text = " "
|
||||
if language in ("zh"): #处理货币似乎只能这里截胡,不然货币符号会被吞
|
||||
from text.zh_normalization.num import (
|
||||
RE_CNY_PREFIX, RE_CNY_SUFFIX, replace_cny_prefix, replace_cny_suffix,
|
||||
RE_USD_SYMBOL, RE_USD_SUFFIX, replace_usd_symbol, replace_usd_suffix,)
|
||||
text = RE_CNY_PREFIX.sub(replace_cny_prefix, text)
|
||||
text = RE_CNY_SUFFIX.sub(replace_cny_suffix, text)
|
||||
text = RE_USD_SYMBOL.sub(replace_usd_symbol, text)
|
||||
text = RE_USD_SUFFIX.sub(replace_usd_suffix, text)
|
||||
for special_s, special_l, target_symbol in special:
|
||||
if special_s in text and language == special_l:
|
||||
return clean_special(text, language, special_s, target_symbol, version)
|
||||
|
Loading…
x
Reference in New Issue
Block a user