mirror of https://github.com/coqui-ai/TTS.git
enhance chinese pinyin dict
This commit is contained in:
parent
dbf1a08a0d
commit
107d45ee5c
|
@ -4,8 +4,12 @@ import jieba
|
|||
import pypinyin
|
||||
|
||||
from .pinyinToPhonemes import PINYIN_DICT
|
||||
from pypinyin_dict.pinyin_data import kxhc1983
|
||||
|
||||
|
||||
def enhance_dict():
|
||||
kxhc1983.load()
|
||||
|
||||
def _chinese_character_to_pinyin(text: str) -> List[str]:
|
||||
pinyins = pypinyin.pinyin(text, style=pypinyin.Style.TONE3, heteronym=False, neutral_tone_with_five=True)
|
||||
pinyins_flat_list = [item for sublist in pinyins for item in sublist]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from typing import Dict
|
||||
|
||||
from TTS.tts.utils.text.chinese_mandarin.phonemizer import chinese_text_to_phonemes
|
||||
from TTS.tts.utils.text.chinese_mandarin.phonemizer import chinese_text_to_phonemes, enhance_dict
|
||||
from TTS.tts.utils.text.phonemizers.base import BasePhonemizer
|
||||
|
||||
_DEF_ZH_PUNCS = "、.,[]()?!〽~『』「」【】"
|
||||
|
@ -27,6 +27,7 @@ class ZH_CN_Phonemizer(BasePhonemizer):
|
|||
|
||||
def __init__(self, punctuations=_DEF_ZH_PUNCS, keep_puncs=False, **kwargs): # pylint: disable=unused-argument
|
||||
super().__init__(self.language, punctuations=punctuations, keep_puncs=keep_puncs)
|
||||
enhance_dict()
|
||||
|
||||
@staticmethod
|
||||
def name():
|
||||
|
|
|
@ -34,6 +34,7 @@ coqpit>=0.0.16
|
|||
# chinese g2p deps
|
||||
jieba
|
||||
pypinyin
|
||||
pypinyin-dict
|
||||
# korean
|
||||
hangul_romanize
|
||||
# gruut+supported langs
|
||||
|
|
Loading…
Reference in New Issue