Multimodal Hadith Analysis Tool – Python API & Flask web app for exploring Hadith texts with search, isnād/ rāwī graphing, and similarity detection.
Ein wissenschaftliches Analyse- und Explorationstool für Hadith-Texte
– inspiriert von Text-Fabric –
mit Python-API (für Jupyter-Notebooks) und Flask-Weboberfläche.
- 📦 Read-Only Data Package (Hadith-Fabric / HF)
Struktur:corpus/,features/,indexes/,meta.json - 🔍 Volltextsuche (Arabisch & Englisch)
- 🧵 Isnād & Rāwī-Extraktion
- 📊 Ähnlichkeitssuche (TF-IDF, Cosine Similarity)
- 🌐 Flask-Frontend für klickbare Exploration
- 📓 Jupyter-kompatible API (
HF-Loader)
hadith-analyzer/
├─ app/ # Flask-App
│ ├─ routes.py
│ ├─ wsgi.py
│ ├─ templates/
│ └─ static/
├─ hadith_analyzer/ # Python-API & Analysefunktionen
│ ├─ hf.py
│ ├─ similarity.py
│ └─ ...
├─ scripts/ # Hilfsskripte (Build, Deploy, Run)
├─ scrapers/ # Scraper für sunnah.com
├─ data/ # Lokale Datenpakete (nicht im Repo)
├─ notebooks/ # Jupyter-Notebooks
├─ requirements.txt
├─ .gitignore
└─ README.md
git clone https://github.com/<USERNAME>/hadith-analyzer.git
cd hadith-analyzerpython -m venv .venv
. .venv/bin/activate # Linux/Mac
.venv\Scripts\Activate # Windowspip install --upgrade pip wheel
pip install -r requirements.txt- Hadith-Daten scrapen (Muslim/Bukhari):
python scrapers/sunnah_scraper.py --collection muslim --parquet
python scrapers/sunnah_scraper.py --collection bukhari --parquet- HF-Datenpaket erstellen:
python scripts/build_hf.py --input data/raw --out data/hf-2025.08# Linux/Mac
export APP_DATA_DIR=$(pwd)/data/hf-2025.08
export FLASK_SECRET=dev
flask --app app/wsgi.py run
# Windows (PowerShell)
$env:APP_DATA_DIR = "$(Get-Location)\data\hf-2025.08"
$env:FLASK_SECRET = "dev"
flask --app app/wsgi.py run→ Öffne: http://127.0.0.1:5000
from hadith_analyzer.hf import HF
hf = HF("data/hf-2025.08")
# Einzelner Hadith
print(hf.get("muslim_12_34"))
# Suche
hits = hf.search("mercy", lang="english", limit=5)
for h in hits:
print(h["id"], h["english"])
# Ähnliche Hadithe
similar = hf.similar("muslim_12_34", topk=5)- Code (
app/,hadith_analyzer/,requirements.txt) + fertiges Datenpaket hochladen - Gunicorn als Service starten:
gunicorn -w 2 -b 127.0.0.1:8000 app.wsgi:app- Reverse Proxy auf Port
8000setzen
MIT License – siehe LICENSE.
Pull Requests, Issues & Feedback willkommen!
Bitte keine großen Datendateien ins Repo committen (siehe .gitignore).
Projekt von Johannes Gottschalk
📧 [email protected]