inoryQwQ's picture
Release 1.0.0: Chinese TTS (Inflect-Micro-v2 arch + BigVGAN), ONNX + AX650 axmodel + checkpoints
0c723b3 verified
Raw
History Blame Contribute Delete
536 Bytes
"""Chinese pinyin character-level symbol set."""
_pad = "_"
# All possible pinyin characters (a-z) plus tone digits (1-5)
_pinyin_chars = "abcdefghijklmnopqrstuvwxyz12345 "
# Chinese punctuation
_punct = ",。!?;:、…—""''()《》·"
symbols = [_pad] + list(_pinyin_chars) + list(_punct)
_symbol_to_id = {s: i for i, s in enumerate(symbols)}
PAD_ID = 0
SPACE_ID = _symbol_to_id.get(" ", len(symbols))
def get_phoneme_ids(phonemes: str) -> list[int]:
return [_symbol_to_id.get(p, PAD_ID) for p in phonemes]