# The data it reads

Taaweel reads four corpora — all local, all opened **read-only** (`readonly: true` +
`query_only = ON`). No research-time network fetch of Quranic content ever happens; the only
online calls in a run go to the LLM provider.

| Corpus | Contents | Source | Used by |
| --- | --- | --- | --- |
| **Quran text** | 6,236 verses (Uthmani + plain), 77,429 word tokens, root per token | `quran_lexicon.db` (from Taaweel 1.0) | concordance, sweeps, every quoted verse |
| **Lexicon** | Lane's Arabic-English Lexicon (5,321 roots / 35,897 entries) + 31 classical dictionaries | `quran_lexicon.db` + crawler | word studies, root-contrast studies |
| **Tafsīr ×5** | al-Ṭabarī, Ibn Kathīr (Ar + En), al-Qurṭubī, al-Baghawī — 6,236 rows each | tafsīr DBs + quran.com fetcher | per-mufassir positions on anchor passages |
| **Hadith** | 34,155 graded reports across 7 collections (Ar + En) | hadith-api importer | targeted hadith dossier, property support |

## The verse-fetching layer

`src/repos/corpus.ts` exposes deterministic fetchers — the report's every Arabic quote comes from
here, never from model memory:

```ts
corpus.verse(41, 9)                  // one verse
corpus.versesBetween(41, 9, 12)      // a passage
corpus.findOccurrences("السماوات")   // the concordance: every occurrence, every verse
corpus.rootConcordance("رسي")        // every verse carrying a root
corpus.verseTokens(2, 29)            // word-by-word tokens with roots
```

> Note on Uthmani orthography: the superscript alef (U+0670) in `سَمَٰوَٰتٍ` is a real letter.
> Taaweel matches on the Uthmani text — reproducing the paper's 190/188 counts exactly — because
> the corpus's plain-text column drops that alef.

## Taaweel's own database

`data/taaweel.db` (the app's own read-write database): questions + refinement chats, runs
and per-stage jobs (tokens, cost, attempts), run events, occurrence maps and classes, the evidence
ledger, claims + claim-evidence links, objections, model artifacts, reports, manual (user-supplied)
science sources, and both chat histories.

## Extending the data

```powershell
npx tsx scripts/fetchHadith.ts bukhari muslim   # full graded collections (public-domain API)
npx tsx scripts/fetchTafsir.ts qurtubi          # also: baghawi | saddi | wasit | muyassar
npx tsx scripts/importTafsir.ts some.db         # any tafsir DB with the same table layout
```
