An algorithmic cheat sheet for Arabic diptotes (mamnūʿ min al-ṣarf)

In order to make sense of the immense complexity of Arabic diptotes I decided to turn all of the rules into an algorithm written in the PHP language. Diptotes (mamnūʿ min al-ṣarf) are Arabic words that do not acquire tanwīn like normal words do and have fatḥa instead of kasra in the jarr position, as in marartu bi-Aḥmada , which would normally be marartu bi-Aḥmadin if it was not a diptote).

Turning the diptote rules into an algorithm means that a grammatical discussion that normally takes about 10 pages of a grammar book is turned into a very small “function” that can be reviewed at a glance.

function is_diptote($word) {
    if(is_not_muḍāf ($word) && does_not_have_definite_al($word)) { // masājid is normally diptotate, but in masājidi l-muslimīn it is NOT diptote due to iḍāfa, likewise afḍal is normally diptote, but in marirtu bi-l-afḍal it is not due to having definite article "al"
        if(sounds_like_mafāʿil($word) || sounds_like_mafāʿīl($word)) { // masājid, ṣaḥāʾif, maṣabīḥ
            return true; // "return true" means it is a diptote
        }
        if(sounds_like_a_verb($word) && (is_proper_noun($word) || is_ṣifa($word))) { // Āhmad, Yashkur, aḥmar, ākhḍar
            return true;
        }
        if(is_maʿdūl($word)) { // maʿdūl = a word that "deviates" from its normal form, as in ʿUmar, a deviation from ʿĀmir
            if(is_proper_noun($word)) { // ʿUmar, Zuḥal, Zufar
                return true;
            }
            if(is_ṣifa($word)) { // ukhar, mathnā, thulātha, rubāʿa, khumāsa, sudāsa, subāʿa, tusāʿa, ʿushāra
                return true;
            }
        }
        if(is_feminine($word)) {
            if(is_feminine_only_in_the_way_it_sounds($word) && is_proper_noun($word)) { // Ṭalḥa, Ḥamza, Qatāda, Muʿāwiya, Khalīfa
                return true;
            }
            if(is_feminine_in_sound_and_meaning($word) && is_proper_noun($word)) { // Faṭima, ʿAʾisha, Khadīja, Munīra, Luʾluʾa, Mājida
                return true;
            }
            if(is_feminine_in_meaning_alone($word) && is_proper_noun($word)) { // Zaynab, Suʿād, Hind
                return true;
            }
            if(has_alif_taʾnīth_mamdūda($word) || has_alif_taʾnīth_maqṣūra($word)) { // ḥamrāʾ, khaḍrāʾ, ṣafrāʾ, sawdāʾ, asmāʾ, ʿuzzā, salmā, salwā, hayā, laylā, ḥublā
                return true;
            }
        }
        if(has_tarkīb_mazjī($word) && is_proper_noun($word)) { // Baʿlabak, Maʿdīkarb, Ḥaḍramawt
            return true;
        }
        if(has_added_alif_and_nūn_at_the_end($word) && (is_proper_noun($word) || is_ṣifa($word)) { // Salmān, Sulaymān, sakrān, ʿaṭshān, ghaḍbān, rayyān
            return true;
        }
        if(is_non_arabic($word) && is_proper_noun($word)) { // Jibrīl, Mīkāl, Isrāʾīl, Ibrāhīm, Ismāʿīl, Isḥāq
            return true;
        }
    }
    return false; // if above conditions are not met, it is not a diptote
}

Commenting rules: Politeness is the only rule. We respect your right to disagree with anything we say. But comments with profanity and insults will be deleted.
Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Muhammad Muslim
Muhammad Muslim
4 years ago

Sir, I am a student in Islamic studies and I need a software that may be able to Romanize Arabic Text like when I type معجم البلدان لياقوت الحموي it may convert it to Yāqūt al-Ḥamawī, Muʿjam al-Buldān. can you please help me?