Conversion_Kitchen_Code/kitchen_counter/conversion/translation/createDict.py

91 lines
1.6 KiB
Python
Raw Permalink Normal View History

2024-04-27 09:33:09 +00:00
import csv
from collections import OrderedDict
vowels = OrderedDict([
('','n'),
('','n'),
('','a'),
('','a'),
('','aa'),
('','i'),
('','ee'),
('','u'),
('','oo'),
('','ri'),
('','e'),
('','ae'),
('','o'),
('','au'),
('','a'),
('ि','i'),
('','i'),
('','u'),
('','oo'),
('','ri'),
('','e'),
('','ai'),
('','o'),
('','au')
])
consonants = OrderedDict([
('','k'),
('','kh'),
('','g'),
('','gh'),
('','ng'),
('','ch'),
('','chh'),
('','j'),
('ज़','z'),
('','z'), #these two are very different, see them in unicode by 'ज़'.encode('utf-8'). You'll see.
('','jh'),
('','nj'),
('','t'),
('','th'),
('','d'),
('ड़','r'),
('','r'), #these two are very different, see them in unicode by 'ड़'.encode('utf-8'). You'll see.
('','dh'),
('','n'),
('','t'),
('','th'),
('','d'),
('','dh'),
('','n'),
('','p'),
('','ph'),
('','f'),
('फ़','f'), #these two फ़ are very different, see them in unicode by 'फ़'.encode('utf-8'). You'll see.
('','b'),
('','bh'),
('','m'),
('','y'),
('','r'),
('','l'),
('','v'),
('','sh'),
('','sh'),
('','s'),
('','h'),
('क्ष','ksh'),
('त्र','tr'),
('ज्ञ','gy')
])
with open('svar.csv', 'w') as f:
csvwriter = csv.writer(f)
for k,v in zip(vowels.keys(), vowels.values()):
csvwriter.writerow([k,v])
with open('vyanjan.csv', 'w') as f:
csvwriter = csv.writer(f)
for k,v in zip(consonants.keys(), consonants.values()):
csvwriter.writerow([k,v])