Skip to main content

Python library for Quran and Hadith books with multi-language support

Project description

📖 Qurango -- Hadith Module

Qurango is a Python library that provides fast, structured, and searchable access to authentic Hadith collections using JSON data bundled directly inside the package.
It is optimized for research, data analysis, NLP, and educational use.

This README explains how the Hadith system works internally and how to use it step by step.


✨ Key Highlights

  • 📚 Loads Hadith data directly from packaged JSON files
  • ⚡ Preprocessed and optimized for fast searching
  • 🔍 Search Hadith by:
    • Keyword
    • Narrator
    • Book name
    • Hadith number
  • 📊 Outputs results as Pandas DataFrames
  • 🌐 Supports Urdu & English text normalization
  • 🧠 Ideal for NLP, ML, and text analytics

📦 Installation

pip install Qurango

🚀 Quick Start

from Qurango.hadith import HadithLoader, HadithSearch

📘 Loading Hadith Data

The HadithLoader class automatically loads all Hadith JSON files from the package data directory and preprocesses them.

loader = HadithLoader()
``>

### ✔ What happens internally?

- Loads JSON files from `qurango.data`
- Converts data to a Pandas DataFrame
- Normalizes Urdu & English text
- Maps Arabic book titles to English names
- Prepares searchable columns for fast queries

---

## 📊 Accessing the DataFrame

```python
df = loader.get_dataframe()
print(df.head())

Total Hadith & Books

loader.total_hadiths()
loader.total_books()

📚 Available Hadith Books

Get as List

books = loader.get_available_books()
print(books)

Get as DataFrame

books_df = loader.get_available_books(as_dataframe=True)
print(books_df)

Print Books Nicely

loader.show_available_books()

🔍 Searching Hadith

Create the search engine:

search = HadithSearch(df)

🔎 Search by Keyword

results = search.search_by_keyword("iman")
print(results)

Search works across: - Hadith title - Urdu translation - English translation


🧑 Search by Narrator

results = search.search_by_narrator("Abu Huraira")
print(results)

Language options: - "urdu" - "english" - "auto" (default)


📖 Search by Book

results = search.search_by_book("Sahih Bukhari")
print(results)

Search by book + hadith number:

results = search.search_by_book("Sahih Bukhari", hadith_number=1)
print(results)

🔢 Search by Hadith Number

results = search.search_by_hadith_number(5)
print(results)

📊 Output Format

All search methods return:

  • ✅ Pandas DataFrame
  • ✅ Easy export to CSV / JSON
  • ✅ Ready for NLP pipelines

Example:

results.to_csv("hadith_results.csv", index=False)

🧠 Use Cases

  • Islamic research & academia
  • NLP on religious texts
  • Machine learning datasets
  • Search engines & chatbots
  • Educational software

🛠 Requirements

  • Python 3.8+
  • pandas

📜 License

MIT License


🙏 Acknowledgment

This Hadith module is built to make authentic Islamic knowledge accessible for developers, researchers, and the global community using modern data tools.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qurango-1.0.0.tar.gz (56.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qurango-1.0.0-py3-none-any.whl (57.5 MB view details)

Uploaded Python 3

File details

Details for the file qurango-1.0.0.tar.gz.

File metadata

  • Download URL: qurango-1.0.0.tar.gz
  • Upload date:
  • Size: 56.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0rc2

File hashes

Hashes for qurango-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d0de2926d8f8a9a598a76d31027d2eef402663a557d32c546e1de1584d848a91
MD5 750ce3102396256aeb2c08327ce78be0
BLAKE2b-256 a73d6b634b61a8f8abd2a6a5917b1064d35c1e7288b75a4267015d34c203b25e

See more details on using hashes here.

File details

Details for the file qurango-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: qurango-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 57.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0rc2

File hashes

Hashes for qurango-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c78d82f46ff616953c8fc7ada8fa8f32ee37b9e2ef6720d809fce441481d2c73
MD5 22f23f364ba40230c2f5764eba55d581
BLAKE2b-256 24b741c100465de42a14180f700cfb92916c03ac95a3d80f24071d25a41a281d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page