mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-10-06 14:40:00 +08:00
Update english.py
添加英文序号转化
This commit is contained in:
parent
c315203dcd
commit
96fc13b6b5
@ -30,6 +30,16 @@ rep_map = {
|
|||||||
"?": "?",
|
"?": "?",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ordinal_map = {
|
||||||
|
"1. ": "First",
|
||||||
|
"2. ": "Second",
|
||||||
|
"3. ": "Third",
|
||||||
|
"4. ": "Fourth",
|
||||||
|
"5. ": "Fifth",
|
||||||
|
"6. ": "Sixth",
|
||||||
|
# 添加更多序数词映射
|
||||||
|
}
|
||||||
|
|
||||||
arpa = {
|
arpa = {
|
||||||
"AH0",
|
"AH0",
|
||||||
"S",
|
"S",
|
||||||
@ -236,6 +246,9 @@ def text_normalize(text):
|
|||||||
# 来自 g2p_en 文本格式化处理
|
# 来自 g2p_en 文本格式化处理
|
||||||
# 增加大写兼容
|
# 增加大写兼容
|
||||||
text = unicode(text)
|
text = unicode(text)
|
||||||
|
for key, value in ordinal_map.items():
|
||||||
|
text = re.sub(rf"{re.escape(key)}\s?", value + ", ", text)
|
||||||
|
|
||||||
text = normalize_numbers(text)
|
text = normalize_numbers(text)
|
||||||
text = ''.join(char for char in unicodedata.normalize('NFD', text)
|
text = ''.join(char for char in unicodedata.normalize('NFD', text)
|
||||||
if unicodedata.category(char) != 'Mn') # Strip accents
|
if unicodedata.category(char) != 'Mn') # Strip accents
|
||||||
|
Loading…
x
Reference in New Issue
Block a user