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

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
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
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
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

Step-by-step iʿrāb drill on Aḍ-Ḍuḥā 93: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
More screens
