Skip to main content

Overview

Lazily loads the Word Map data. This large dataset is loaded asynchronously to avoid increasing the initial bundle size. The word map enables mapping normalized query tokens to their canonical lemma and root forms.

Signature

Return value

Promise
A Promise that resolves to the WordMap object. This is a dictionary mapping normalized Arabic words to their lemma and root information.

WordMap structure

The WordMap is an object with normalized tokens as keys:
object
Each key is a normalized Arabic word/token from the Quran
string
The canonical lemma (dictionary form) of the word
string
The root letters of the word (typically 3-4 letters separated by spaces)

Example

The word map is used to resolve query tokens into lemmas and roots:

How it works

The word map enables advanced morphological matching:

Data source

The word mapping data comes from Quranic Arabic Corpus v4.0: https://corpus.quran.com

Error handling

Throws an error if the word map data file cannot be loaded:

Without word map

You can use the search function without a word map (lemma/root matching disabled):

Performance consideration

The word map is loaded once at application startup and reused across all searches. This provides fast O(1) lookups during query resolution without repeated file reads.