forked from smtiitm/Fastspeech2_MFA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_phone_mapped_python.py
67 lines (62 loc) · 1.37 KB
/
get_phone_mapped_python.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
class TextReplacer:
def __init__(self):
self.replacements = {
'aa':'A',
'ae':'ऍ',
'ag':'ऽ',
'ai':'ऐ',
'au':'औ',
'axx':'अ',
'ax':'ऑ',
'bh':'B',
'ch':'C',
'dh':'ध',
'dxhq':'T',
'dxh':'ढ',
'dxq':'D',
'dx':'ड',
'ee':'E',
'ei':'ऐ',
'eu':'உ',
'gh':'घ',
'gq':'G',
'hq':'H',
'ii':'I',
'jh':'J',
'khq':'K',
'kh':'ख',
'kq':'क',
'ln':'ൾ',
'lw':'ൽ',
'lx':'ള',
'mq':'M',
'nd':'ऩ',
'ng':'ङ',
'nj':'ञ',
'nk':'Y',
'nn':'N',
'nw':'ൺ',
'nx':'ण',
'oo':'O',
'ou':'औ',
'ph':'P',
'rqw':'ॠ',
'rq':'R',
'rw':'ർ',
'rx':'ऱ',
'sh':'श',
'sx':'ष',
'txh':'ठ',
'th':'थ',
'tx':'ट',
'uu':'U',
'wv':'W',
'zh':'Z'
# ... 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