ACE — Morphology Flowcharts

ACE — Morphology Flowcharts

This page shows high–level diagrams of how ACE analyzes an input word, from raw text → root → form → tense → pronoun / declension, and finally to Arabic, IPA, and Tajwīd-colored output.

Overview

1. Global Analysis Pipeline

At a high level, every ACE tool (Analyzer, Stem Tester, Reverse Analyzer) passes through the same core stages:

User Input
   ↓
Normalize (Latin / Arabic)
   ↓
Tokenize (prefix, stem, suffix)
   ↓
Dictionary / root lookup
   ↓
Form & pattern detection (I–X, weak vs strong)
   ↓
Tense / pronoun / declension resolution
   ↓
Arabic script + IPA + Tajwīd coloring
   ↓
Frequency lookup (Qurʼān DB) & translations

The following sections break this into separate flowcharts:

Flowchart A

2. Forward Analyzer — From Root to Conjugation

Step A1 — Input

User chooses: root (r0–r1–r2), form (I–X), tense (1–43), pronoun, and optionally declension.

Step A2 — Build Base Pattern

ACE builds a canonical stem pattern for that form: faʿala, faʿʿala, fāʿala, ʼafʿala, tafaʿʿala, … using your $infl1, $infl2 and form rules.

Step A3 — Attach Prefix / Suffix

Pronoun + tense decide: prefix (e.g. ya-, ta-, na-, ea-) and suffix (e.g. -u, -na, -uwna or declension endings). ACE combines them into: $prefix . $stem . $suffix.

Step A4 — Arabic / IPA / Color

The combined Latin form is passed to:

  • latinToArabic() → full Arabic string
  • latinToIPA() → IPA with long vowels highlighted
  • Tajwīd renderer → Qalqalah, throat, Tafkhīm colors

Step A5 — Frequency & Meaning

ACE queries the Qurʼān DB for the transliteration token and displays:

  • Frequency count (with link to verse list)
  • English and Urdu translations (root-based)
  • Labels: Form I, Active Imperfect, etc.

Visualization — Prefix / Stem / Suffix

يَكْتُبُونَ

Prefix
Stem
Suffix / Declension

The same color system is used consistently in the Analyzer, Stem Tester, and documentation tables.

Flowchart B

3. Reverse Analyzer — From Word Back to Root

This flow is used by ace_reverse_analyzer.php and the standalone tool in /ace/reverse/.

Step B1 — Input & Normalization

User enters an Arabic or Latin word (e.g. yaktubuwna or يَكْتُبُونَ). ACE normalizes:

  • Trims spaces / punctuation
  • Unifies transliteration (digraphs like sh, kh, AA)
  • Maps Arabic letters to your Latin scheme if needed

Step B2 — Suffix & Prefix Stripping

Using merged suffix arrays: verb endings, declension endings, attached pronouns, ACE removes the longest matching suffix first, then checks for imperfect prefixes.

Longest match first

Step B3 — Core Stem & Root Guess

The remaining core (e.g. yaktub) is analyzed letter-by-letter:

  • Drop imperfect prefix ya-, ta-, na-, eu- if present
  • Identify three radicals (r0, r1, r2)
  • Infer v1, v2 from remaining vowels

Step B4 — Form & Tense Guess

Using patterns (doubling, extra ta, sta, internal vowels), ACE proposes a likely form and tense:

  • Form I vs Form II (doubled middle radical)
  • Form VIII (internal ta, assimilation rules)
  • Active vs passive (u–i / a–i patterns)

Step B5 — Dictionary & Display

If the root exists in your dictionary arrays, ACE displays:

  • Root with color-coded radicals
  • Arabic spelling (core vs full with suffixes)
  • IPA + Tajwīd coloring
  • English / Urdu glosses (if available)
  • Qurʼān frequency and verse links
Flowchart C

4. Weak Verb Handling Inside the Flow

Weak verbs follow the same pipeline, but extra checks are inserted after root detection:

Step C1 — Tag Weak Type

After extracting r0, r1, r2, ACE tags the verb as:

  • Assimilated (weak r0)
  • Hollow (weak r1)
  • Defective (weak r2)
  • Doubly weak (two weak radicals)

Step C2 — Adjust Pattern

For example, a hollow verb in passive past will use fuʿilaقِيلَ; a defective verb will drop the final vowel in jussive / imperative.

Visualization — Root Colors

ق و ل  →  قَالَ, يَقُولُ, قِيلَ

r0 (1st radical)
r1 (2nd radical)
r2 (3rd radical)

These colors match the legend in color_legend.php and are reused in Analyzer and Stem Tester outputs.