Skip to main content

quran-text-tools

Match the Uthmani (Mushaf) text of the Quran with ordinary typed Arabic, and find every verse quoted in a text and check it word by word against the Mushaf.

From the makers of Quranic Atlas (أطلس علاقات الكلمات القرآنية), where the same method powers the verse checker (مدقق الآيات).

Why

People type «الصلاة», «الرحمن», «يا أيها»; the Mushaf writes «ٱلصَّلَوٰةَ», «ٱلرَّحۡمَٰنِ», «يَٰٓأَيُّهَا». Plain string matching fails on almost every word. Quotations in sermons, articles and posts often carry a changed word («ربي» for «رب»), a missing one, or «أن» where the Mushaf has «إن». This library handles both.

Install

pip install quran-text-tools

Or the latest code: pip install git+https://github.com/NasserWasfiBaBreak/quran-text-tools

Python 3.9+, no dependencies.

The Quran text

The text is not bundled. Use the official text of the King Fahd Complex for the Printing of the Holy Quran (مجمع الملك فهد لطباعة المصحف الشريف), Hafs from ʿĀṣim, and respect its terms. Load it from a CSV with columns surah, ayah, text, or a JSON list:

from quran_text_tools import Quran
quran = Quran.from_csv('quran_hafs.csv')

Use

from quran_text_tools import find_quotations, skeleton

skeleton('ٱلصَّلَوٰةَ') == skeleton('الصلاة')          # True

for q in find_quotations('قال تعالى: ﴿وقل ربي زدني علما﴾', quran):
    print(q.ref, q.correct)                         # 20:114 False
    print(q.differences)                            # [{'kind': 'changed', 'written': 'ربي', 'mushaf': 'رَّبِّ'}]
    print(q.suggestion)                             # وَقُل رَّبِّ زِدۡنِي عِلۡمٗا

From the command line:

echo 'قال تعالى: ﴿وقل ربي زدني علما﴾' | python -m quran_text_tools quran_hafs.csv

What counts as a difference

  • Not a difference (spelling): diacritics and Quranic marks; ٱ أ إ آ (= ا); ى (= ي); ة (= ه); hamza seats; the small alif and و with a small alif (الرحمن / الرحمان, الصلاة); the small و/ي heard after a final pronoun (بِهِۦ); «يا أيها» written as two words.
  • A difference: a word changed, left out or added, and «أ» where the Mushaf has «إ» (or the reverse) at the start of a word.

A quotation needs at least four matching words (three inside quotation marks), with at most one edit for every three matching words. Text inside quotation marks («…» ﴿…﴾ "…") is compared as a whole, and a quotation never runs across a quotation mark. When the same wording occurs in several places, also_at lists them.

License

MIT. The Quran text you load is under its own terms.

Metadata

Release files for quran-text-tools 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quran-text-tools 0.1.0
File Size Uploaded Provenance Actions
quran_text_tools-0.1.0.tar.gz 12.4 kB With provenance Details for quran_text_tools-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for quran-text-tools 0.1.0
File Interpreter ABI Platform Actions
quran_text_tools-0.1.0-py3-none-any.whl Python 3 none any Details for quran_text_tools-0.1.0-py3-none-any.whl

Total release size: 24.1 kB

Release files / quran_text_tools-0.1.0.tar.gz

Download URL quran_text_tools-0.1.0.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7facf506236599394b60fcff5b88c944b930e1c91d23079d0576e36c24b9d31d
BLAKE2b-256 checksum
How to use checksums
87b68a4c840301e5ea53385f76ff31d7577ff095d4750939dc1b09bd1b38943d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / quran_text_tools-0.1.0-py3-none-any.whl

Download URL quran_text_tools-0.1.0-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0309799134203302140ab0b4f6c22002e6efc7720a554557f28631a1197ac0e
BLAKE2b-256 checksum
How to use checksums
59f8530a95efa978d8cb8430dbc222e99c1eb7fcbfdfa2c06dbeb93667015e2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for quran-text-tools 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for quran_text_tools-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page