Fastspeech2_HS_Flask_API / get_phone_mapped_python.py
k-m-irfan's picture
updated large files with lfs
9f1c059
raw
history blame contribute delete
983 Bytes
class TextReplacer:
def __init__(self):
self.replacements = {
'aa': 'A',
'ii': 'I',
'uu': 'U',
'ee': 'E',
'oo': 'O',
'nn': 'N',
'ae': 'ऍ',
'ag': 'ऽ',
'au': 'औ',
'axx': 'अ',
'ax': 'ऑ',
'bh': 'B',
'ch': 'C',
'dh': 'ध',
'dx': 'ड',
'dxh': 'ढ',
'dxhq': 'T',
'dxq': 'D',
'ei': 'ऐ',
'ai': 'ऐ',
'eu': 'உ',
'gh': 'घ',
'gq': 'G',
'hq': 'H',
'jh': 'J',
'kh': 'ख',
'khq': 'K',
'kq': 'क',
# ... Add more replacements as needed
}
def apply_replacements(self, text):
for key, value in self.replacements.items():
# print('KEY AND VALUE OF PARSED OUTPUT',key, value)
text = text.replace(key, value)
text = text.replace(" ", "")
return text