File size: 865 Bytes
5178dd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
ARABIC_TO_HEBREW_LETTER_MAP = {
    "ا": "א",
    "ب": "ב",
    "ج": "ג׳",
    "غ": "ג",
    "د": "ד",
    "ذ": "דֿ",
    "ه": "ה",
    "ة": "ה׳",
    "و": "ו",
    "ز": "ז",
    "ح": "ח",
    "ط": "ט",
    "ظ": "ט׳",
    "ي": "י",
    "ك": "כ",
    "خ": "כ׳",
    "ل": "ל",
    "م": "מ",
    "ن": "נ",
    "س": "ס",
    "ع": "ע",
    "ف": "פ",
    "ص": "צ",
    "ض": "צ׳",
    "ق": "ק",
    "ر": "ר",
    "ش": "ש",
    "ت": "ת",
    "ث": "ת׳",
    "ء": "א",
    "ئ": "י",
    "ؤ": "ו",
    "ى": "א",
    "؟": "?",
    "إ": "א",
    "آ": "א",
    "أ": "א",
}


def transliterate_arabic_to_hebrew(text):
    assert isinstance(text, str), "Cannot transliterate non-string values"
    result_chars = [ARABIC_TO_HEBREW_LETTER_MAP.get(c, c) for c in text]
    return "".join(result_chars)