mirror of
https://github.com/wassname/TTS.git
synced 2026-09-20 12:30:22 +08:00
41 lines
1.5 KiB
Python
41 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
'''
|
|
Defines the set of symbols used in text input to the model.
|
|
|
|
The default is a set of ASCII characters that works well for English or text that has been run
|
|
through Unidecode. For other data, you can modify _characters. See TRAINING_DATA.md for details.
|
|
'''
|
|
|
|
_pad = '_'
|
|
_eos = '~'
|
|
_bos = '^'
|
|
_characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!\'(),-.:;? '
|
|
_punctuations = '!\'(),-.:;? '
|
|
_phoneme_punctuations = '.!;:,?'
|
|
|
|
# Phonemes definition
|
|
_vowels = 'iyɨʉɯuɪʏʊeøɘəɵɤoɛœɜɞʌɔæɐaɶɑɒᵻ'
|
|
_non_pulmonic_consonants = 'ʘɓǀɗǃʄǂɠǁʛ'
|
|
_pulmonic_consonants = 'pbtdʈɖcɟkɡqɢʔɴŋɲɳnɱmʙrʀⱱɾɽɸβfvθðszʃʒʂʐçʝxɣχʁħʕhɦɬɮʋɹɻjɰlɭʎʟ'
|
|
_suprasegmentals = 'ˈˌːˑ'
|
|
_other_symbols = 'ʍwɥʜʢʡɕʑɺɧ '
|
|
_diacrilics = 'ɚ˞ɫ'
|
|
_phonemes = sorted(list(_vowels + _non_pulmonic_consonants + _pulmonic_consonants + _suprasegmentals + _other_symbols + _diacrilics))
|
|
|
|
# Prepend "@" to ARPAbet symbols to ensure uniqueness (some are the same as uppercase letters):
|
|
_arpabet = ['@' + s for s in _phonemes]
|
|
|
|
# Export all symbols:
|
|
symbols = [_pad, _eos, _bos] + list(_characters) + _arpabet
|
|
phonemes = [_pad, _eos, _bos] + list(_phonemes) + list(_punctuations)
|
|
|
|
# Generate ALIEN language
|
|
# from random import shuffle
|
|
# shuffle(phonemes)
|
|
|
|
if __name__ == '__main__':
|
|
print(" > TTS symbols {}".format(len(symbols)))
|
|
print(symbols)
|
|
print(" > TTS phonemes {}".format(len(phonemes)))
|
|
print(phonemes)
|