Update preprocess_text.py

This commit is contained in:
Stardust·减
2023-08-03 18:19:37 +08:00
committed by GitHub
parent ef14bfe762
commit b91d6d8cb5

View File

@@ -17,7 +17,8 @@ if 1 in stage:
with open( transcription_path+'.cleaned', 'w', encoding='utf-8') as f:
for line in tqdm.tqdm(open(transcription_path, encoding='utf-8').readlines()):
try:
utt, spk, language, text = line.strip().split('|')
utt, spk, text = line.strip().split('|')
language = "ZH"
norm_text, phones, tones, word2ph = clean_text(text, language)
f.write('{}|{}|{}|{}|{}|{}|{}\n'.format(utt, spk, language, norm_text, ' '.join(phones),
" ".join([str(i) for i in tones]),
@@ -62,4 +63,4 @@ if 3 in stage:
config = json.load(open(config_path))
config["data"]['spk2id'] = spk_id_map
with open(config_path, 'w', encoding='utf-8') as f:
json.dump(config, f, indent=2, ensure_ascii=False)
json.dump(config, f, indent=2, ensure_ascii=False)