-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlatinizator.py
More file actions
143 lines (141 loc) · 4.56 KB
/
latinizator.py
File metadata and controls
143 lines (141 loc) · 4.56 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#! python3
from time import sleep
#printProgressBar is a free solution from Stackoverflow. Credit goes to Greenstick. Thank you.
def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█'):
"""
Call in a loop to create terminal progress bar
@params:
iteration - Required : current iteration (Int)
total - Required : total iterations (Int)
prefix - Optional : prefix string (Str)
suffix - Optional : suffix string (Str)
decimals - Optional : positive number of decimals in percent complete (Int)
length - Optional : character length of bar (Int)
fill - Optional : bar fill character (Str)
"""
percent = ("{0:." + str(decimals) + "f}").format(100 * (iteration / float(total)))
filledLength = int(length * iteration // total)
bar = fill * filledLength + ' ' * (length - filledLength)
print('\r%s |%s| %s%% %s' % (prefix, bar, percent, suffix), end = '\r')
# Print New Line on Complete
if iteration == total:
print()
text = input("Your text in Cyrillic: ")
char=0
text = text.lower()
LatText=""
while True:
if (len(text)-1) >= char:
if text[char] == "а":
LatText = LatText + "a"
char+=1
elif text[char] == "б":
LatText = LatText + "b"
char+=1
elif text[char] == "в":
LatText = LatText + "v"
char+=1
elif text[char] == "г":
LatText = LatText + "g"
char+=1
elif text[char] == "д":
LatText = LatText + "d"
char+=1
elif text[char] == "е":
LatText = LatText + "e"
char+=1
elif text[char] == "ж":
LatText = LatText + "j"
char+=1
elif text[char] == "з":
LatText = LatText + "z"
char+=1
elif text[char] == "и":
LatText = LatText + "i"
char+=1
elif text[char] == "й":
LatText = LatText + "i"
char+=1
elif text[char] == "к":
LatText = LatText + "k"
char+=1
elif text[char] == "л":
LatText = LatText + "l"
char+=1
elif text[char] == "м":
LatText = LatText + "m"
char+=1
elif text[char] == "н":
LatText = LatText + "n"
char+=1
elif text[char] == "о":
LatText = LatText + "o"
char+=1
elif text[char] == "п":
LatText = LatText + "p"
char+=1
elif text[char] == "р":
LatText = LatText + "r"
char+=1
elif text[char] == "с":
LatText = LatText + "s"
char+=1
elif text[char] == "т":
LatText = LatText + "t"
char+=1
elif text[char] == "у":
LatText = LatText + "u"
char+=1
elif text[char] == "ф":
LatText = LatText + "f"
char+=1
elif text[char] == "х":
LatText = LatText + "h"
char+=1
elif text[char] == "ц":
LatText = LatText + "c"
char+=1
elif text[char] == "ч":
LatText = LatText + "ch"
char+=1
elif text[char] == "ш":
LatText = LatText + "sh"
char+=1
elif text[char] == "щ":
LatText = LatText + "sht"
char+=1
elif text[char] == "ъ":
LatText = LatText + "y"
char+=1
elif text[char] == "ь":
LatText = LatText + "x"
char+=1
elif text[char] == "ю":
LatText = LatText + "iu"
char+=1
elif text[char] == "я":
LatText = LatText + "q"
char+=1
elif text[char] == "ѝ":
LatText = LatText + "i"
char+=1
elif text[char] == " ":
LatText = LatText + "-"
char+=1
elif text[char] == "\"":
char+=1
elif text[char] == ",":
char+=1
elif text[char] == ".":
char+=1
elif text[char] == ":":
char+=1
elif text[char] == ";":
char+=1
else:
print("Unnown char.")
break
else:
break
printProgressBar(char, len(text), prefix="Progress: ", suffix="done.", length=20)
print(LatText)