-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathArabicToOSL.py
More file actions
59 lines (54 loc) · 1 KB
/
Copy pathArabicToOSL.py
File metadata and controls
59 lines (54 loc) · 1 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
def ArabicToOSL(word, mapping):
latin_word = ''
for letter in word:
if letter in mapping:
latin_word += mapping[letter]
else:
latin_word += letter
# For Tachkil
latin_word = latin_word.replace('َ', 'a')
latin_word = latin_word.replace('ُ', 'o')
latin_word = latin_word.replace('ِ', 'i')
return latin_word
mapping = {
'ا': 'A',
'ب': 'b',
'ت': 't',
'ث': 't',
'ج': 'j',
'ح': 'H',
'خ': 'X',
'د': 'd',
'ذ': 'd',
'ر': 'r',
'ز': 'z',
'س': 's',
'ش': '$',
'ص': 'S',
'ض': 'D',
'ط': 'T',
'ظ': 'D',
'ع': 'E',
'غ': 'G',
'ف': 'f',
'ق': 'q',
'ك': 'q',
'ل': 'l',
'م': 'm',
'ن': 'n',
'ه': 'h',
'و': 'w',
'ي': 'y',
'ة':'"',
'ئ':'^y',
'ؤ':'^w',
'أ':'^A',
'إ':'A^',
'ء':'^',
'َ': 'a',
'ُ': 'o',
'ِ': 'i',
}
arabic_word = 'بغِيتُ ندِيرُ فطُور معَ العَائِلَة'
latin_word = ArabicToOSL(arabic_word, mapping)
print(latin_word)