Logo Lanfrica

tomrosenbergg/egypt-transliterate

Domaine:

natural language processing

Type de record:

software
Créateur:
tom
Hôte:
Egyptian arabic transliterator based on the Lisaan Masry system # Egyptian Arabic Transliteration Engine This repository contains a single rule-based transliteration engine for Arabic text: - Function: `STRICT_ARABIZI(text)` - File: `/Users/tom/Documents/GitHub/egypt-transliterate/Code.gs` The engine is deterministic and rule-ordered. It is designed for practical, consistent output rather than academic transliteration. ## What It Produces The output is mixed Arabizi/Latin and is not strictly ASCII. - Arabizi-style symbols: `2`, `3`, `5`, `7`, `8` - Latin digraphs: `sh` - Extended Latin characters: `ā`, `ã`, `ś`, `ź` Examples: - `هذا -> hāźā` - `الشمس -> ish-shms` - `القمر -> il-'mr` - `بالشمس -> bish-shms` - `فالقمر -> fil-'mr` ## API ### Google Apps Script function ```javascript STRICT_ARABIZI(text: any): string ``` - Returns `""` for falsy input. - Otherwise converts input to string and transliterates character-by-character with rule overrides. ## Character Mapping ### Hamza forms - `ء -> 2` - `أ -> 2` - `إ -> 2` - `ؤ -> 2` - `ئ -> 2` - `آ -> 2ã` ### Main consonants - `ب -> b` - `ت -> t` - `ث -> ś` - `ج -> g` - `ح -> 7` - `خ -> 5` - `د -> d` - `ذ -> ź` - `ر -> r` - `ز -> z` - `س -> s` - `ش -> sh` - `ص -> S` - `ض -> D` - `ط -> T` - `ظ -> Z` - `ع -> 3` - `غ -> 8` - `ف -> f` - `ق -> '` - `ك -> k` - `ل -> l` - `م -> m` - `ن -> n` - `ه -> h` - `و -> w` - `ي -> y` - `ى -> ā` ### Diacritics - `َ -> a` - `ُ -> u` - `ِ -> i` - `ً -> an` - `ٌ -> un` - `ٍ -> in` - `ّ -> shadda marker (gemination logic)` - `ْ -> ""` (sukun is silent) - `ٰ -> ā` ## Rule Order (How The Engine Works) Rules are applied in this order for each character. Order matters. 1. Skip isolated diacritics. 2. Irregular dictionary lookup for whole words. 3. Attached clitic + irregular lookup for leading single-letter clitics (`و/ف/ب/ك/ل`), such as `وهذا`, `بهذا`. 4. Special-case `لله` pattern (`llāh` path). 5. Silent-alif checks. 6. Definite article logic: - Attached clitic + `ال` (for example `بالشمس`, `فالقمر`, `كالشمس`). - `لِ + ال` sun-letter as …