mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2026-01-11 04:46:57 +08:00
Simplify i18n text and remove trailing spaces
This commit is contained in:
parent
4748f1a6b0
commit
9ce83c8eea
@ -744,7 +744,7 @@ class TTS:
|
|||||||
if path in [None, ""]:
|
if path in [None, ""]:
|
||||||
continue
|
continue
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
print(i18n("音频文件不存在,跳过:{}").format(path))
|
print(i18n("音频文件不存在,跳过:"), path)
|
||||||
continue
|
continue
|
||||||
self.prompt_cache["refer_spec"].append(self._get_ref_spec(path))
|
self.prompt_cache["refer_spec"].append(self._get_ref_spec(path))
|
||||||
|
|
||||||
@ -787,7 +787,7 @@ class TTS:
|
|||||||
precision=self.precision
|
precision=self.precision
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
print(i18n("############ 切分文本 ############"))
|
print(f'############ {i18n("切分文本")} ############')
|
||||||
texts = self.text_preprocessor.pre_seg_text(text, text_lang, text_split_method)
|
texts = self.text_preprocessor.pre_seg_text(text, text_lang, text_split_method)
|
||||||
data = []
|
data = []
|
||||||
for i in range(len(texts)):
|
for i in range(len(texts)):
|
||||||
@ -797,7 +797,7 @@ class TTS:
|
|||||||
|
|
||||||
def make_batch(batch_texts):
|
def make_batch(batch_texts):
|
||||||
batch_data = []
|
batch_data = []
|
||||||
print(i18n("############ 提取文本Bert特征 ############"))
|
print(f'############ {i18n("提取文本Bert特征")} ############')
|
||||||
for text in tqdm(batch_texts):
|
for text in tqdm(batch_texts):
|
||||||
phones, bert_features, norm_text = self.text_preprocessor.segment_and_extract_feature_for_text(text, text_lang, self.configs.version)
|
phones, bert_features, norm_text = self.text_preprocessor.segment_and_extract_feature_for_text(text, text_lang, self.configs.version)
|
||||||
if phones is None:
|
if phones is None:
|
||||||
|
|||||||
@ -56,11 +56,11 @@ class TextPreprocessor:
|
|||||||
self.device = device
|
self.device = device
|
||||||
|
|
||||||
def preprocess(self, text:str, lang:str, text_split_method:str, version:str="v2")->List[Dict]:
|
def preprocess(self, text:str, lang:str, text_split_method:str, version:str="v2")->List[Dict]:
|
||||||
print(i18n("############ 切分文本 ############"))
|
print(f'############ {i18n("切分文本")} ############')
|
||||||
text = self.replace_consecutive_punctuation(text)
|
text = self.replace_consecutive_punctuation(text)
|
||||||
texts = self.pre_seg_text(text, lang, text_split_method)
|
texts = self.pre_seg_text(text, lang, text_split_method)
|
||||||
result = []
|
result = []
|
||||||
print(i18n("############ 提取文本Bert特征 ############"))
|
print(f'############ {i18n("提取文本Bert特征")} ############')
|
||||||
for text in tqdm(texts):
|
for text in tqdm(texts):
|
||||||
phones, bert_features, norm_text = self.segment_and_extract_feature_for_text(text, lang, version)
|
phones, bert_features, norm_text = self.segment_and_extract_feature_for_text(text, lang, version)
|
||||||
if phones is None or norm_text=="":
|
if phones is None or norm_text=="":
|
||||||
@ -239,6 +239,3 @@ class TextPreprocessor:
|
|||||||
pattern = f'([{punctuations}])([{punctuations}])+'
|
pattern = f'([{punctuations}])([{punctuations}])+'
|
||||||
result = re.sub(pattern, r'\1', text)
|
result = re.sub(pattern, r'\1', text)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user