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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
---
language:
- ar
- en
license: mit
task_categories:
- question-answering
- text-generation
- text-retrieval
- fill-mask
pretty_name: Athar Islamic QA Datasets
tags:
- islamic-studies
- quran
- hadith
- fiqh
- arabic
- rag
- multi-agent
- citation-grounded
dataset_info:
  features:
  - name: content
    dtype: string
  - name: content_type
    dtype: string
  - name: book_id
    dtype: int64
  - name: book_title
    dtype: string
  - name: category
    dtype: string
  - name: author
    dtype: string
  - name: author_death
    dtype: int64
  - name: collection
    dtype: string
  - name: page_number
    dtype: int64
  - name: section_title
    dtype: string
  - name: hierarchy
    sequence: string
  - name: title
    dtype: string
  - name: chapter
    dtype: string
  - name: section
    dtype: string
  - name: page
    dtype: int64
  splits:
  - name: train
    num_bytes: 42600000000
    num_examples: 5700000
  download_size: 4300000000
  dataset_size: 42600000000
---

# ๐Ÿ•Œ Athar Islamic QA Datasets

> **15.7M passages from 8,425 classical Islamic books spanning 1,400 years of scholarship**

A comprehensive collection of Islamic texts covering Quran, Hadith, Fiqh, Tafsir, Aqeedah, Seerah, and more โ€” sourced from the Shamela library and enriched with scholarly metadata for RAG-based Islamic QA systems.

**Based on the Fanar-Sadiq Architecture** for grounded, citation-backed Islamic question answering.

---

## ๐Ÿ“Š Dataset Summary

| Metric | Value |
|--------|-------|
| **Total Passages** | 15,700,000+ |
| **Total Source Books** | 8,425 |
| **Total Scholars** | 3,146 |
| **Time Span** | 0-1400 AH (7th-21st century CE) |
| **Original Size** | 42.6 GB |
| **Compressed Size** | ~4.3 GB |
| **Collections** | 10 |
| **Languages** | Arabic (primary), English (metadata) |

---

## ๐Ÿ“š Collections

### 1. `hadith_passages` (2M passages, 11 GB)

Prophetic traditions from the six canonical hadith collections (Kutub al-Sittah) plus Musnad collections.

| Feature | Details |
|---------|---------|
| Source Books | Sahih Bukhari, Sahih Muslim, Sunan Abu Dawud, Jami' al-Tirmidhi, Sunan al-Nasa'i, Sunan Ibn Majah |
| Includes | Sanad (chain of narrators) and Matn (text) |
| Authenticity Data | โœ… Esnad chain data available |
| Time Period | 0-300 AH |

**Schema:**
```json
{
  "content": "ุญุฏูŠุซ: ุนู† ุฃุจูŠ ู‡ุฑูŠุฑุฉ ุฑุถูŠ ุงู„ู„ู‡ ุนู†ู‡ ู‚ุงู„...",
  "book_id": 627,
  "title": "ุตุญูŠุญ ุงู„ุจุฎุงุฑูŠ",
  "author": "Imam Bukhari",
  "author_death": 256,
  "page": 45,
  "chapter": "ูƒุชุงุจ ุงู„ุตู„ุงุฉ",
  "section": "ุจุงุจ ุงู„ุฃุฐุงู†",
  "category": "ุตุญูŠุญ",
  "collection": "hadith_passages"
}
```

---

### 2. `fiqh_passages` (1.2M passages, 7 GB)

Islamic jurisprudence from all four major Sunni schools (Hanafi, Maliki, Shafi'i, Hanbali).

| Feature | Details |
|---------|---------|
| Schools Covered | Hanafi, Maliki, Shafi'i, Hanbali |
| Topics | Worship, Transactions, Family Law, Criminal Law |
| Time Period | 150-1300 AH |
| Source Books | 2,000+ fiqh texts |

---

### 3. `general_islamic` (1M passages, 6.5 GB)

General Islamic knowledge including spirituality, ethics, dua, and daily life guidance.

| Feature | Details |
|---------|---------|
| Topics | Spirituality, Ethics, Dua, Adab, Daily Life |
| Time Period | 0-1400 AH |
| Source Books | 1,500+ texts |

---

### 4. `islamic_history_passages` (900K passages, 6 GB)

Islamic history from the Prophetic era through the Ottoman period.

| Feature | Details |
|---------|---------|
| Periods | Prophetic, Rashidun, Umayyad, Abbasid, Ottoman |
| Topics | Battles, Biographies, Dynasties, Events |
| Time Period | 0-1400 AH |

---

### 5. `quran_tafsir` (800K passages, 5.2 GB)

Quranic exegesis from classical tafsir works.

| Feature | Details |
|---------|---------|
| Tafsir Works | Tabari, Qurtubi, Ibn Kathir, Jalalayn, etc. |
| Coverage | All 114 surahs, 6,236 verses |
| Languages | Classical Arabic |
| Time Period | 200-900 AH |

---

### 6. `arabic_language_passages` (400K passages, 2.3 GB)

Arabic grammar, linguistics, rhetoric, and language sciences.

| Feature | Details |
|---------|---------|
| Topics | Nahw, Sarf, Balaghah, Arabic Lexicons |
| Time Period | 150-1300 AH |

---

### 7. `aqeedah_passages` (300K passages, 1.8 GB)

Islamic creed and theology from various theological schools.

| Feature | Details |
|---------|---------|
| Schools | Ash'ari, Maturidi, Athari |
| Topics | Tawhid, Attributes of Allah, Prophethood, Afterlife |
| Time Period | 200-1300 AH |

---

### 8. `spirituality_passages` (200K passages, 1.1 GB)

Islamic spirituality, purification of the heart, and Sufi works.

| Feature | Details |
|---------|---------|
| Topics | Tasawwuf, Tazkiyah, Adab, Dhikr |
| Time Period | 200-1300 AH |

---

### 9. `usul_fiqh` (150K passages, 0.9 GB)

Principles of Islamic jurisprudence and legal theory.

| Feature | Details |
|---------|---------|
| Topics | Usul al-Fiqh, Qawa'id Fiqhiyyah, Maqasid al-Shari'ah |
| Time Period | 200-1200 AH |

---

### 10. `seerah_passages` (100K passages, 0.8 GB)

Prophet Muhammad's ๏ทบ biography and related studies.

| Feature | Details |
|---------|---------|
| Sources | Ibn Hisham, Ibn Kathir, Al-Rahiq al-Makhtum |
| Topics | Birth, Prophethood, Migration, Battles, Death ๏ทบ |
| Time Period | 200-1400 AH |

---

## ๐Ÿ“ File Structure

```
Athar-Datasets/
โ”œโ”€โ”€ collections/
โ”‚   โ”œโ”€โ”€ fiqh_passages.jsonl.gz        # 7.0 GB compressed
โ”‚   โ”œโ”€โ”€ hadith_passages.jsonl.gz       # 11.0 GB compressed
โ”‚   โ”œโ”€โ”€ quran_tafsir.jsonl.gz          # 5.2 GB compressed
โ”‚   โ”œโ”€โ”€ aqeedah_passages.jsonl.gz      # 1.8 GB compressed
โ”‚   โ”œโ”€โ”€ seerah_passages.jsonl.gz       # 0.8 GB compressed
โ”‚   โ”œโ”€โ”€ islamic_history_passages.jsonl.gz  # 6.0 GB compressed
โ”‚   โ”œโ”€โ”€ arabic_language_passages.jsonl.gz  # 2.3 GB compressed
โ”‚   โ”œโ”€โ”€ spirituality_passages.jsonl.gz # 1.1 GB compressed
โ”‚   โ”œโ”€โ”€ general_islamic.jsonl.gz       # 6.5 GB compressed
โ”‚   โ””โ”€โ”€ usul_fiqh.jsonl.gz             # 0.9 GB compressed
โ”‚
โ””โ”€โ”€ metadata/
    โ”œโ”€โ”€ master_catalog.json            # 8,425 books catalog
    โ”œโ”€โ”€ category_mapping.json          # 41โ†’10 category mapping
    โ””โ”€โ”€ author_catalog.json            # 3,146 scholars
```

---

## ๐Ÿ” How to Load

### Python (using huggingface_hub)

```python
from huggingface_hub import hf_hub_download
import json

# Download a collection
filepath = hf_hub_download(
    repo_id="Kandil7/Athar-Datasets",
    filename="collections/fiqh_passages.jsonl.gz",
    repo_type="dataset"
)

# Load passages
import gzip
passages = []
with gzip.open(filepath, 'rt', encoding='utf-8') as f:
    for line in f:
        passages.append(json.loads(line))

print(f"Loaded {len(passages):,} passages")
```

### Load with metadata

```python
# Load metadata
master_catalog = hf_hub_download(
    repo_id="Kandil7/Athar-Datasets",
    filename="metadata/master_catalog.json",
    repo_type="dataset"
)

author_catalog = hf_hub_download(
    repo_id="Kandil7/Athar-Datasets",
    filename="metadata/author_catalog.json",
    repo_type="dataset"
)

# Enrich passages with additional metadata
with open(author_catalog, 'r') as f:
    authors = json.load(f)
```

---

## ๐Ÿ’ก Usage Examples

### Example 1: Semantic Search

```python
from sentence_transformers import SentenceTransformer

# Load model
model = SentenceTransformer('BAAI/bge-m3')

# Embed query
query = "ู…ุง ุญูƒู… ุตู„ุงุฉ ุงู„ุฌู…ุงุนุฉุŸ"
query_embedding = model.encode(query)

# Search in collection (requires vector DB like Qdrant)
# See: https://github.com/Kandil7/Athar
```

### Example 2: Faceted Search

```python
# Filter by era and collection
classical_passages = [
    p for p in passages
    if 200 <= p.get('author_death', 0) <= 500  # Classical era
    and p.get('collection') == 'fiqh_passages'
]

# Filter by author
bukhari_hadith = [
    p for p in hadith_passages
    if 'Bukhari' in p.get('author', '')
]
```

### Example 3: Citation-Enhanced QA

```python
# Build a RAG pipeline
from Athar import FiqhAgent

agent = FiqhAgent()
result = await agent.execute(
    query="ู…ุง ุญูƒู… ุตู„ุงุฉ ุงู„ุฌู…ุงุนุฉุŸ",
    filters={"era": "classical"},
    hierarchical=True
)

# Result includes rich citations:
print(result.citations[0].source)
# "Imam Bukhari - Sahih al-Bukhari, Chapter of Prayer"
print(result.citations[0].metadata['hadith_grade'])
# "sahih"
```

---

## ๐Ÿ—๏ธ Scholarly Eras

| Era | Range (AH) | Range (CE) | Description |
|-----|-----------|-----------|-------------|
| **Prophetic** | 0-100 | 622-718 | Companions of Prophet ๏ทบ |
| **Tabi'un** | 100-200 | 718-815 | Successors |
| **Classical** | 200-500 | 815-1106 | Golden age of Islamic scholarship |
| **Medieval** | 500-900 | 1106-1496 | Post-classical period |
| **Ottoman** | 900-1300 | 1496-1883 | Ottoman era |
| **Modern** | 1300+ | 1883+ | Modern period |

---

## ๐Ÿ“– Source: ElShamela Library (ุงู„ู…ูƒุชุจุฉ ุงู„ุดุงู…ู„ุฉ)

This dataset is derived from **ElShamela Library** (ุงู„ู…ูƒุชุจุฉ ุงู„ุดุงู…ู„ุฉ) โ€” the largest comprehensive digital library of Islamic texts, containing **8,425 books** across **41 categories** spanning **1,400 years of Islamic scholarship**.

### About ElShamela Library

**ElShamela** (ุงู„ู…ูƒุชุจุฉ ุงู„ุดุงู…ู„ุฉ) is a free, open-access digital library that has been digitizing and preserving classical Islamic texts for over two decades. It is widely considered the most comprehensive collection of Islamic heritage works, including:

- **Quran and Tafsir** โ€” Complete Quran text with major classical commentaries
- **Hadith Collections** โ€” Six canonical hadith books (Kutub al-Sittah) plus Musnad works
- **Fiqh** โ€” Jurisprudence from all four major Sunni schools (Hanafi, Maliki, Shafi'i, Hanbali)
- **Aqeedah** โ€” Islamic theology and creed from various schools
- **Seerah** โ€” Prophet Muhammad's ๏ทบ biography
- **Arabic Language** โ€” Grammar, linguistics, rhetoric, and lexicons
- **Islamic History** โ€” Historical accounts from the Prophetic era through the Ottoman period
- **Spirituality** โ€” Tasawwuf, ethics, and purification of the heart
- **Usul Fiqh** โ€” Principles of Islamic jurisprudence and legal theory

**Website:** https://shamela.ws/

### Processing Pipeline

1. **Extracted** 8,425 books from ElShamela Library format
2. **Converted** from proprietary Shamela format to plain text
3. **Split** into pages and passages for granular retrieval
4. **Enriched** with metadata:
   - Author names and death years (Hijri calendar)
   - Book titles and categories
   - Chapter and section headings
   - Page numbers
5. **Organized** into 10 scholarly collections based on subject matter
6. **Added** hadith chain (esnad) data where available
7. **Compressed** with gzip for efficient storage and transfer

### ElShamela Statistics

| Metric | Value |
|--------|-------|
| Total Books | 8,425 |
| Total Categories | 41 |
| Total Authors | 3,146 |
| Time Span | 0-1400+ AH (7th-21st century CE) |
| Original Size | 17.16 GB (extracted text) |
| Languages | Classical Arabic (primary) |

---

## ๐Ÿ“Š Statistics

### Passages per Collection

| Collection | Passages | Size (GB) | % of Total |
|------------|----------|-----------|------------|
| hadith_passages | ~2,000,000 | 11.0 | 35% |
| fiqh_passages | ~1,200,000 | 7.0 | 21% |
| general_islamic | ~1,000,000 | 6.5 | 18% |
| islamic_history_passages | ~900,000 | 6.0 | 16% |
| quran_tafsir | ~800,000 | 5.2 | 14% |
| arabic_language_passages | ~400,000 | 2.3 | 7% |
| aqeedah_passages | ~300,000 | 1.8 | 5% |
| spirituality_passages | ~200,000 | 1.1 | 4% |
| usul_fiqh | ~150,000 | 0.9 | 3% |
| seerah_passages | ~100,000 | 0.8 | 2% |

### Scholar Distribution

| Era | Scholars | Books | Passages |
|-----|----------|-------|----------|
| Prophetic | 150 | 12 | 50,000 |
| Tabi'un | 280 | 85 | 200,000 |
| Classical | 1,200 | 2,800 | 2,500,000 |
| Medieval | 800 | 3,200 | 1,800,000 |
| Ottoman | 500 | 1,800 | 900,000 |
| Modern | 216 | 528 | 250,000 |

---

## ๐Ÿค Related Projects

- **[Athar](https://github.com/Kandil7/Athar)** โ€” The parent project: A production-ready Islamic QA system using these datasets
- **[Fanar-Sadiq Architecture](docs/Fanar-Sadiq%20A%20Multi-Agent%20Architecture%20for%20Grounded%20Islamic%20QA.pdf)** โ€” Research paper that inspired this system
- **[Quran.com](https://quran.com)** โ€” Quran text reference
- **[Sunnah.com](https://sunnah.com)** โ€” Hadith collections reference

---

## ๐Ÿ“ Citation

If you use this dataset in your research, please cite:

```bibtex
@misc{athar-datasets-2026,
  title={Athar: A Multi-Agent Architecture for Grounded Islamic QA},
  author={Kandil, [Author Name]},
  year={2026},
  url={https://huggingface.co/datasets/Kandil7/Athar-Datasets},
  note={Based on the Fanar-Sadiq architecture}
}
```

---

## โš ๏ธ Usage Notes

1. **Scholarly Context:** These texts represent classical Islamic scholarship. Always consult qualified scholars for religious rulings.

2. **Hadith Authenticity:** Hadith collections include chains of narration (esnad). Use the authenticity grading system to evaluate reliability.

3. **Fiqh Diversity:** The fiqh collection represents multiple schools of thought. Present all views when answering questions.

4. **Language:** Primary content is in Classical Arabic. Metadata includes English translations.

5. **Licensing:** MIT License โ€” free for research and commercial use. Please attribute appropriately.

---

## ๐Ÿ“ž Contact & Support

- **GitHub:** https://github.com/Kandil7/Athar
- **Issues:** https://github.com/Kandil7/Athar/issues
- **HuggingFace:** https://huggingface.co/Kandil7

---

<div align="center">

**Built with โค๏ธ for the Muslim community**

๐Ÿ•Œ Athar Islamic QA Datasets โ€ข 5.7M passages โ€ข 8,425 books โ€ข 1,400 years of scholarship

</div>