File size: 983 Bytes
9f1c059 |
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 |
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
|