Skip to main content

Overview

Lazily loads the Quran morphology data. This large dataset is loaded asynchronously to avoid increasing the initial bundle size. The morphology data enables lemma and root matching for advanced search capabilities.

Signature

Return value

Promise
A Promise that resolves to a Map where the key is the verse global identifier (gid) and the value is morphology data for that verse.

MorphologyAya structure

Each morphology entry contains:
number
Global unique identifier for the verse (matches QuranText.gid)
string[]
Array of lemmas (dictionary forms) for all words in the verse
string[]
Array of roots for all words in the verse

Example

Enable lemma and root matching by providing the morphology map:

Data structure benefits

The function transforms the source array into a Map for O(1) lookup performance:

Data source

The morphological data (lemmas and roots) comes from Quranic Arabic Corpus v4.0: https://corpus.quran.com

Error handling

Throws an error if the morphology data file cannot be loaded:

Without morphology

You can still use the search function without morphology data (lemma/root matching disabled):