Projects

lenses

Offline PWA for Quranic Arabic grammar: tap any word to see its morphology alongside classical iʿrāb and ṣarf, labelled by source.

Status
Live
Platform
Installable web app · works offline
Built with
React 19 · TypeScript · Python
Coverage
114 surahs · 6,236 verses
Languages
English · Arabic · Indonesian
Gate
pnpm gate · quality-kit CI
Harness
Claude · Cursor · Antigravity CLI
Started
Oct 2026
Lenses showing Al-Hashr 59:18 with the word waltanẓur selected and its segments, classical iʿrāb, and ṣarf in a side sheet
Al-Ḥashr 59:18 with a selected word's segments, root, and classical iʿrāb/ṣarf.

Overview

Lenses brings computational morphology and classical grammar into one screen. Tap any word to view segments, root, and lemma from the Quranic Arabic Corpus, classical iʿrāb and ṣarf from the Tafsir Center, and an optional NoorBayan dependency tree.

A Python pipeline compiles all datasets into static per-surah JSON served as a free Cloudflare PWA, powering offline reading and precomputed grammar drills.

Stack

App

React 19 + Vite
Hash-routed SPA (#/surah/verse/word) for deep-linking any verse or word.
vite-plugin-pwa
Precaches the shell and downloads surah JSON and fonts in the background.
Custom SVG tree layout
RTL dependency arcs with Arabic labels and clause brackets, no graph library.

Data pipeline

Python build scripts
Compiles morphology, syntax, similar verses, and Tafsir Center data into versioned JSON.
TypeScript quiz builder
Precomputes the grammar quiz bank at build time with zero runtime NLP.

Hosting & quality

Cloudflare Workers Static Assets
Long-lived asset caching, revalidated HTML, and isolated branch previews.
quality-kit (js-ts + python)
Biome, strict TypeScript, import-graph and complexity ratchets, plus ruff and basedpyright.

Engineering highlights

  1. Three scholarly sources aligned word by word

    Because the corpus, treebank, and Tafsir Center tokenize differently, the build aligns segments per verse—omitting classical fields rather than attaching them to the wrong word when alignment isn't exact.

    Read the code:README: data & alignmentbuild_qurandb_enrichment.py

  2. Licensing as a design constraint

    Every source's licence is tracked alongside its data: no-derivatives texts stay verbatim, GPL files keep their notice, and unlicensed sources are explicitly excluded.

    Read the code:Sources & licences

  3. Grammar drills built from the treebank

    Precomputed drills walk words step by step through iʿrāb (role, governor, case, sign), ṣarf patterns, and near-identical verses—all served statically.

    Read the code:build_quiz_bank.ts

    Lenses iʿrāb drill asking for the syntactic role of a word in Ad-Duha 93:4, with four steps: role, governor, case, sign
    Step-by-step iʿrāb drill on Aḍ-Ḍuḥā 93:4.
  4. Right-to-left SVG dependency trees

    The optional NoorBayan layer renders RTL arcs with Arabic labels and clause brackets, using dashed arcs when a grammatical head carries over from a prior verse.

    Read the code:NoorBayanTree.tsx

Decisions

  • Arabic NLP & morphology
  • SVG layout
  • Offline-first PWA
  • Internationalisation · RTL
  • Open-data licensing
  • Cloudflare Workers