ACE β Reverse Analyzer Flowchart (Full Specification)
This flowchart describes EXACTLY how ACE reverses any surface form (Latin or Arabic):
verbs, nouns, particles, conjunctions, and irregular forms such as qi.
Every decision node below corresponds to a step in the future implementation.
D0 β Normalize Input
- Lowercase string
- Trim whitespace
- Remove punctuation
- S = clean(S)
D1 β Attached Object Pronoun?
Check longest β shortest:
humunna, humA, hum, kunna, kumA, kum, hunna, hi, haA, hA, hu, naA, ni, na
D2 β Imperfect Verb Suffix?
Check for:
uwna, iyna, aAni, ani, yni, na, u, a, i
D3 β Perfect Verb Suffix?
tumunna, tumaA, tunna, tum, naa, naA, tu, ta, ti, aa, at, uu
D4 β Noun Declension Suffix?
- Sound plurals:
uuna, iina - Dual:
aAni, ayni, ayini, ataAni, atayni - Feminine:
a(t)(un), a(t)(in), a(t)(an) - Tanwin:
un, in, an - Short vowel:
u, i, a
D5 β Extract r2
Scan backward until first consonant:
b, t, th, j, H, kh, d, dh, r, z, s, sh, S, D, T, Z, e, gh, f, q, k, l, m, n, h, w, y
D6 β Extract v2
Scan backward for first vowel:
a, i, u, A
D7 β Extract r1
Next consonant from right.
D8 β Gemination Check
If next character equals r1 β doubled β Form II or V candidate.
D9 β Extract v1
Next vowel from right.
D10 β Extract r0
Next consonant from right β we now have r0 r1 r2.
D11 β Conjunctions
fa, wa, la, bi, li
D12 β Particles (24β44)
qad, sa, sawfa, lan, lam, laA, maA, inna, laβalla, kaβanna, hal
D13 β Imperfect Prefix?
ya, ta, na, ea, yu, tu, nu, eu
Form Detection (Based on Prefix + Gemination + Vowels)
D14 β Form X?
sta, ista
D15 β Form VII?
in, eink, iink
D16 β Form V?
Prefix ta + geminated r1
D17 β Form VI?
Prefix ta + long vowel aA
D18 β Form II?
Gemination + no ta prefix.
D19 β Form IV?
ea, eA
DEFAULT β Form I
D20 β Imperfect?
If imperfect prefix + imperfect suffix.
Perfect?
If perfect suffix and no imperfect prefix.
Imperative?
If bare stem and known imperative patterns.
Noun?
If declension suffix was detected or root-pattern matches noun weights.
D21 β Short-word Exception?
Examples:
qi, qina, qiyna, quw
Map from irregular imperative table (root wqy etc.).
This flowchart is the authoritative logic specification for the ACE Reverse Analyzer.
Every block here will be implemented step-by-step inside reverse_analyzer.php.