Methodology · v1
A computational affective lexicon of the Qur'an
And the consolation engine built upon it — the corpus, the classification, the matching, the evidence, and the limits we do not hide.
Jiwa maps the emotional vocabulary of the Qur'an and uses it to meet a person's stated feeling with the verse that already addresses it — consoling through the account of a prophet who felt the same, never issuing a ruling. This note documents the corpus, the affective classification, the consolation layer, the matching method, and the validation, including what the system does not yet claim. Every figure below is computed from the production data set and is reproducible from source.
IThe corpus — an affective lexicon
The unit of analysis is the Qur'anic word in place. Each token is resolved to its triliteral Arabic root, glossed for meaning, assigned a salience score, and located structurally within its sūrah.
Each token is classified into one of eight affective clusters — Seen, Fear, Doubt, Awe, Grief, Loneliness, Shame, Weight. The pipeline is deterministic and versioned: the same text yields the same lexicon, so the map can be audited and reproduced rather than trusted on assertion.
IIThe affective map — قبض / بسط
The clusters are organized under the classical Qur'anic polarity of qabḍ (contraction) and basṭ (expansion) — the tightening and the opening of the heart. At the map layer the taxonomy widens to ten clusters, adding Hope and Helplessness, resolved against 2,004 verse-level fingerprints. The framework is drawn from the text and its tradition, not imposed from modern affect theory.
IIIThe consolation layer
Above the lexicon sits the console atlas: the emotional states a person actually arrives in, each paired with a curated response.
Every consolation is written by hand and tied to a verified source; 12 sources carry their occasion of revelation (asbāb al-nuzūl) and 38 carry classical narrative detail (Ibn Kathīr), each graded for authenticity. A reveal-safety axis of five wound-types — desire, loss, injustice, doubt, unworthiness — governs which reframe is safe for a given wound; where the type is ambiguous, the system withholds the reframe and simply sits with the person.
IVMatching — from stated feeling to verse
Interpretation runs in two stages. A lexical detector maps the person's own words to an emotional state. Where it cannot resolve confidently, a multilingual sentence embedding (paraphrase-multilingual-MiniLM-L12-v2, 8-bit) routes the input by nearest-seed cosine similarity, gated by a confidence margin — below the margin, the system asks for a little more rather than guess.
Candidate verses are then scored across eight dimensions: salience, structural significance, intensity alignment, novelty, arc coherence, qabḍ/basṭ alignment, sūrah profile, and a multivalent-root bonus. The machinery stays hidden; the person only feels the result.
VValidation
The system is measured against a held-out set of 66 labelled synthetic confessions spanning English, Malay, and rojak, and both direct and oblique phrasing.
The safety-critical metric is not accuracy but error direction: a miss fails to a gentle reprompt, never to a wrong answer. Across the set, no confession was routed to a consolation for a different wound. The system is deliberately not tuned to this evaluation — fitting the 66 cases would inflate the figure and degrade generalization; the honest instrument is a held-out set (§VII).
VIThe trust contract
- Reveal, never rule. The system consoles and reopens the verdict a wound has passed on itself. It does not issue religious rulings.
- Zero generated scripture. No verse, translation, or claim is produced by a language model at serving time. What cannot be sourced is not said.
- A duty-of-care floor. Input indicating crisis is routed to human help, with no verse served. The system knows the boundary of what an application should hold.
VIILimitations & what is not yet claimed
Rigor is as much what is withheld as what is asserted.
- Validation to date uses synthetic confessions. A held-out set of real, consented inputs is required before the comprehension figures generalize to live use.
- Broader statistical null-testing — permutation tests with false-discovery-rate control on claimed affective patterns — is planned, not yet performed here.
- The oblique / rojak comprehension tail (70–79%) is unresolved, left open rather than overfitted.
- Scholar sign-off is pending. Every served verse and claim is built to be reviewed — the complete served-content inventory is prepared for exactly this — but formal sign-off by a qualified scholar is the gate before any public claim of correctness, and it is in progress.
Figures computed from the Jiwa production data set, v1. Reproducible from source. The complete served-content inventory — every verse, translation, and attribution — is available for scholarly review on request.