add text normalize

This commit is contained in:
yifanyeung 2024-10-30 10:40:40 -07:00
parent 8ca2b2695e
commit 50b97d4332

3
egs/libriheavy/TTS/local/prepare_manifest.py Normal file → Executable file
View File

@ -34,8 +34,7 @@ class TextNormlizer:
# brackets # brackets
# Always text inside brackets with numbers in them. Usually corresponds to "(Sam 23:17)" # Always text inside brackets with numbers in them. Usually corresponds to "(Sam 23:17)"
text = re.sub(r"\([^\)]*\d[^\)]*\)", " ", text) text = re.sub(r"\([^\)]*\d[^\)]*\)", " ", text)
if remove_brackets: text = re.sub(r"\([^\)]*\)", " ", text)
text = re.sub(r"\([^\)]*\)", " ", text)
# Apply mappings # Apply mappings
table = str.maketrans("’‘,。;?!():-《》、“”【】", "'',.;?!(): <>/\"\"[]") table = str.maketrans("’‘,。;?!():-《》、“”【】", "'',.;?!(): <>/\"\"[]")