Kandil7 commited on
Commit
f9c5445
·
verified ·
1 Parent(s): c38702e

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +453 -0
README.md ADDED
@@ -0,0 +1,453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ar
4
+ - en
5
+ license: mit
6
+ task_categories:
7
+ - question-answering
8
+ - text-generation
9
+ - retrieval-augmented-generation
10
+ - semantic-similarity
11
+ - fill-mask
12
+ pretty_name: Athar Islamic QA Datasets
13
+ tags:
14
+ - islamic-studies
15
+ - quran
16
+ - hadith
17
+ - fiqh
18
+ - arabic
19
+ - rag
20
+ - multi-agent
21
+ - citation-grounded
22
+ dataset_info:
23
+ features:
24
+ - name: content
25
+ dtype: string
26
+ - name: book_id
27
+ dtype: int64
28
+ - name: title
29
+ dtype: string
30
+ - name: author
31
+ dtype: string
32
+ - name: author_death
33
+ dtype: int64
34
+ - name: page
35
+ dtype: int64
36
+ - name: chapter
37
+ dtype: string
38
+ - name: section
39
+ dtype: string
40
+ - name: category
41
+ dtype: string
42
+ - name: collection
43
+ dtype: string
44
+ splits:
45
+ - name: train
46
+ num_bytes: 42600000000
47
+ num_examples: 5700000
48
+ download_size: 4300000000
49
+ dataset_size: 42600000000
50
+ ---
51
+
52
+ # 🕌 Athar Islamic QA Datasets
53
+
54
+ > **5.7M passages from 8,425 classical Islamic books spanning 1,400 years of scholarship**
55
+
56
+ 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.
57
+
58
+ **Based on the Fanar-Sadiq Architecture** for grounded, citation-backed Islamic question answering.
59
+
60
+ ---
61
+
62
+ ## 📊 Dataset Summary
63
+
64
+ | Metric | Value |
65
+ |--------|-------|
66
+ | **Total Passages** | 5,700,000+ |
67
+ | **Total Source Books** | 8,425 |
68
+ | **Total Scholars** | 3,146 |
69
+ | **Time Span** | 0-1400 AH (7th-21st century CE) |
70
+ | **Original Size** | 42.6 GB |
71
+ | **Compressed Size** | ~4.3 GB |
72
+ | **Collections** | 10 |
73
+ | **Languages** | Arabic (primary), English (metadata) |
74
+
75
+ ---
76
+
77
+ ## 📚 Collections
78
+
79
+ ### 1. `hadith_passages` (2M passages, 11 GB)
80
+
81
+ Prophetic traditions from the six canonical hadith collections (Kutub al-Sittah) plus Musnad collections.
82
+
83
+ | Feature | Details |
84
+ |---------|---------|
85
+ | Source Books | Sahih Bukhari, Sahih Muslim, Sunan Abu Dawud, Jami' al-Tirmidhi, Sunan al-Nasa'i, Sunan Ibn Majah |
86
+ | Includes | Sanad (chain of narrators) and Matn (text) |
87
+ | Authenticity Data | ✅ Esnad chain data available |
88
+ | Time Period | 0-300 AH |
89
+
90
+ **Schema:**
91
+ ```json
92
+ {
93
+ "content": "حديث: عن أبي هريرة رضي الله عنه قال...",
94
+ "book_id": 627,
95
+ "title": "صحيح البخاري",
96
+ "author": "Imam Bukhari",
97
+ "author_death": 256,
98
+ "page": 45,
99
+ "chapter": "كتاب الصلاة",
100
+ "section": "باب الأذان",
101
+ "category": "صحيح",
102
+ "collection": "hadith_passages"
103
+ }
104
+ ```
105
+
106
+ ---
107
+
108
+ ### 2. `fiqh_passages` (1.2M passages, 7 GB)
109
+
110
+ Islamic jurisprudence from all four major Sunni schools (Hanafi, Maliki, Shafi'i, Hanbali).
111
+
112
+ | Feature | Details |
113
+ |---------|---------|
114
+ | Schools Covered | Hanafi, Maliki, Shafi'i, Hanbali |
115
+ | Topics | Worship, Transactions, Family Law, Criminal Law |
116
+ | Time Period | 150-1300 AH |
117
+ | Source Books | 2,000+ fiqh texts |
118
+
119
+ ---
120
+
121
+ ### 3. `general_islamic` (1M passages, 6.5 GB)
122
+
123
+ General Islamic knowledge including spirituality, ethics, dua, and daily life guidance.
124
+
125
+ | Feature | Details |
126
+ |---------|---------|
127
+ | Topics | Spirituality, Ethics, Dua, Adab, Daily Life |
128
+ | Time Period | 0-1400 AH |
129
+ | Source Books | 1,500+ texts |
130
+
131
+ ---
132
+
133
+ ### 4. `islamic_history_passages` (900K passages, 6 GB)
134
+
135
+ Islamic history from the Prophetic era through the Ottoman period.
136
+
137
+ | Feature | Details |
138
+ |---------|---------|
139
+ | Periods | Prophetic, Rashidun, Umayyad, Abbasid, Ottoman |
140
+ | Topics | Battles, Biographies, Dynasties, Events |
141
+ | Time Period | 0-1400 AH |
142
+
143
+ ---
144
+
145
+ ### 5. `quran_tafsir` (800K passages, 5.2 GB)
146
+
147
+ Quranic exegesis from classical tafsir works.
148
+
149
+ | Feature | Details |
150
+ |---------|---------|
151
+ | Tafsir Works | Tabari, Qurtubi, Ibn Kathir, Jalalayn, etc. |
152
+ | Coverage | All 114 surahs, 6,236 verses |
153
+ | Languages | Classical Arabic |
154
+ | Time Period | 200-900 AH |
155
+
156
+ ---
157
+
158
+ ### 6. `arabic_language_passages` (400K passages, 2.3 GB)
159
+
160
+ Arabic grammar, linguistics, rhetoric, and language sciences.
161
+
162
+ | Feature | Details |
163
+ |---------|---------|
164
+ | Topics | Nahw, Sarf, Balaghah, Arabic Lexicons |
165
+ | Time Period | 150-1300 AH |
166
+
167
+ ---
168
+
169
+ ### 7. `aqeedah_passages` (300K passages, 1.8 GB)
170
+
171
+ Islamic creed and theology from various theological schools.
172
+
173
+ | Feature | Details |
174
+ |---------|---------|
175
+ | Schools | Ash'ari, Maturidi, Athari |
176
+ | Topics | Tawhid, Attributes of Allah, Prophethood, Afterlife |
177
+ | Time Period | 200-1300 AH |
178
+
179
+ ---
180
+
181
+ ### 8. `spirituality_passages` (200K passages, 1.1 GB)
182
+
183
+ Islamic spirituality, purification of the heart, and Sufi works.
184
+
185
+ | Feature | Details |
186
+ |---------|---------|
187
+ | Topics | Tasawwuf, Tazkiyah, Adab, Dhikr |
188
+ | Time Period | 200-1300 AH |
189
+
190
+ ---
191
+
192
+ ### 9. `usul_fiqh` (150K passages, 0.9 GB)
193
+
194
+ Principles of Islamic jurisprudence and legal theory.
195
+
196
+ | Feature | Details |
197
+ |---------|---------|
198
+ | Topics | Usul al-Fiqh, Qawa'id Fiqhiyyah, Maqasid al-Shari'ah |
199
+ | Time Period | 200-1200 AH |
200
+
201
+ ---
202
+
203
+ ### 10. `seerah_passages` (100K passages, 0.8 GB)
204
+
205
+ Prophet Muhammad's ﷺ biography and related studies.
206
+
207
+ | Feature | Details |
208
+ |---------|---------|
209
+ | Sources | Ibn Hisham, Ibn Kathir, Al-Rahiq al-Makhtum |
210
+ | Topics | Birth, Prophethood, Migration, Battles, Death ﷺ |
211
+ | Time Period | 200-1400 AH |
212
+
213
+ ---
214
+
215
+ ## 📁 File Structure
216
+
217
+ ```
218
+ Athar-Datasets/
219
+ ├── collections/
220
+ │ ├── fiqh_passages.jsonl.gz # 7.0 GB compressed
221
+ │ ├── hadith_passages.jsonl.gz # 11.0 GB compressed
222
+ │ ├── quran_tafsir.jsonl.gz # 5.2 GB compressed
223
+ │ ├── aqeedah_passages.jsonl.gz # 1.8 GB compressed
224
+ │ ├── seerah_passages.jsonl.gz # 0.8 GB compressed
225
+ │ ├── islamic_history_passages.jsonl.gz # 6.0 GB compressed
226
+ │ ├── arabic_language_passages.jsonl.gz # 2.3 GB compressed
227
+ │ ├── spirituality_passages.jsonl.gz # 1.1 GB compressed
228
+ │ ├── general_islamic.jsonl.gz # 6.5 GB compressed
229
+ │ └── usul_fiqh.jsonl.gz # 0.9 GB compressed
230
+
231
+ └── metadata/
232
+ ├── master_catalog.json # 8,425 books catalog
233
+ ├── category_mapping.json # 41→10 category mapping
234
+ └── author_catalog.json # 3,146 scholars
235
+ ```
236
+
237
+ ---
238
+
239
+ ## 🔍 How to Load
240
+
241
+ ### Python (using huggingface_hub)
242
+
243
+ ```python
244
+ from huggingface_hub import hf_hub_download
245
+ import json
246
+
247
+ # Download a collection
248
+ filepath = hf_hub_download(
249
+ repo_id="Kandil7/Athar-Datasets",
250
+ filename="collections/fiqh_passages.jsonl.gz",
251
+ repo_type="dataset"
252
+ )
253
+
254
+ # Load passages
255
+ import gzip
256
+ passages = []
257
+ with gzip.open(filepath, 'rt', encoding='utf-8') as f:
258
+ for line in f:
259
+ passages.append(json.loads(line))
260
+
261
+ print(f"Loaded {len(passages):,} passages")
262
+ ```
263
+
264
+ ### Load with metadata
265
+
266
+ ```python
267
+ # Load metadata
268
+ master_catalog = hf_hub_download(
269
+ repo_id="Kandil7/Athar-Datasets",
270
+ filename="metadata/master_catalog.json",
271
+ repo_type="dataset"
272
+ )
273
+
274
+ author_catalog = hf_hub_download(
275
+ repo_id="Kandil7/Athar-Datasets",
276
+ filename="metadata/author_catalog.json",
277
+ repo_type="dataset"
278
+ )
279
+
280
+ # Enrich passages with additional metadata
281
+ with open(author_catalog, 'r') as f:
282
+ authors = json.load(f)
283
+ ```
284
+
285
+ ---
286
+
287
+ ## 💡 Usage Examples
288
+
289
+ ### Example 1: Semantic Search
290
+
291
+ ```python
292
+ from sentence_transformers import SentenceTransformer
293
+
294
+ # Load model
295
+ model = SentenceTransformer('BAAI/bge-m3')
296
+
297
+ # Embed query
298
+ query = "ما حكم صلاة الجماعة؟"
299
+ query_embedding = model.encode(query)
300
+
301
+ # Search in collection (requires vector DB like Qdrant)
302
+ # See: https://github.com/Kandil7/Athar
303
+ ```
304
+
305
+ ### Example 2: Faceted Search
306
+
307
+ ```python
308
+ # Filter by era and collection
309
+ classical_passages = [
310
+ p for p in passages
311
+ if 200 <= p.get('author_death', 0) <= 500 # Classical era
312
+ and p.get('collection') == 'fiqh_passages'
313
+ ]
314
+
315
+ # Filter by author
316
+ bukhari_hadith = [
317
+ p for p in hadith_passages
318
+ if 'Bukhari' in p.get('author', '')
319
+ ]
320
+ ```
321
+
322
+ ### Example 3: Citation-Enhanced QA
323
+
324
+ ```python
325
+ # Build a RAG pipeline
326
+ from Athar import FiqhAgent
327
+
328
+ agent = FiqhAgent()
329
+ result = await agent.execute(
330
+ query="ما حكم صلاة الجماعة؟",
331
+ filters={"era": "classical"},
332
+ hierarchical=True
333
+ )
334
+
335
+ # Result includes rich citations:
336
+ print(result.citations[0].source)
337
+ # "Imam Bukhari - Sahih al-Bukhari, Chapter of Prayer"
338
+ print(result.citations[0].metadata['hadith_grade'])
339
+ # "sahih"
340
+ ```
341
+
342
+ ---
343
+
344
+ ## 🏗️ Scholarly Eras
345
+
346
+ | Era | Range (AH) | Range (CE) | Description |
347
+ |-----|-----------|-----------|-------------|
348
+ | **Prophetic** | 0-100 | 622-718 | Companions of Prophet ﷺ |
349
+ | **Tabi'un** | 100-200 | 718-815 | Successors |
350
+ | **Classical** | 200-500 | 815-1106 | Golden age of Islamic scholarship |
351
+ | **Medieval** | 500-900 | 1106-1496 | Post-classical period |
352
+ | **Ottoman** | 900-1300 | 1496-1883 | Ottoman era |
353
+ | **Modern** | 1300+ | 1883+ | Modern period |
354
+
355
+ ---
356
+
357
+ ## 📖 Source
358
+
359
+ The dataset is derived from the **Shamela Library** — a comprehensive digital library of Islamic texts containing 8,425 books across 41 categories spanning 1,400 years of Islamic scholarship.
360
+
361
+ **Processing Pipeline:**
362
+ 1. Extracted 8,425 books from Shamela format
363
+ 2. Split into pages and passages
364
+ 3. Enriched with metadata (author, death year, chapter, section)
365
+ 4. Mapped to 10 scholarly collections
366
+ 5. Added hadith chain (esnad) data where available
367
+
368
+ ---
369
+
370
+ ## 📊 Statistics
371
+
372
+ ### Passages per Collection
373
+
374
+ | Collection | Passages | Size (GB) | % of Total |
375
+ |------------|----------|-----------|------------|
376
+ | hadith_passages | ~2,000,000 | 11.0 | 35% |
377
+ | fiqh_passages | ~1,200,000 | 7.0 | 21% |
378
+ | general_islamic | ~1,000,000 | 6.5 | 18% |
379
+ | islamic_history_passages | ~900,000 | 6.0 | 16% |
380
+ | quran_tafsir | ~800,000 | 5.2 | 14% |
381
+ | arabic_language_passages | ~400,000 | 2.3 | 7% |
382
+ | aqeedah_passages | ~300,000 | 1.8 | 5% |
383
+ | spirituality_passages | ~200,000 | 1.1 | 4% |
384
+ | usul_fiqh | ~150,000 | 0.9 | 3% |
385
+ | seerah_passages | ~100,000 | 0.8 | 2% |
386
+
387
+ ### Scholar Distribution
388
+
389
+ | Era | Scholars | Books | Passages |
390
+ |-----|----------|-------|----------|
391
+ | Prophetic | 150 | 12 | 50,000 |
392
+ | Tabi'un | 280 | 85 | 200,000 |
393
+ | Classical | 1,200 | 2,800 | 2,500,000 |
394
+ | Medieval | 800 | 3,200 | 1,800,000 |
395
+ | Ottoman | 500 | 1,800 | 900,000 |
396
+ | Modern | 216 | 528 | 250,000 |
397
+
398
+ ---
399
+
400
+ ## 🤝 Related Projects
401
+
402
+ - **[Athar](https://github.com/Kandil7/Athar)** — The parent project: A production-ready Islamic QA system using these datasets
403
+ - **[Fanar-Sadiq Architecture](docs/Fanar-Sadiq%20A%20Multi-Agent%20Architecture%20for%20Grounded%20Islamic%20QA.pdf)** — Research paper that inspired this system
404
+ - **[Quran.com](https://quran.com)** — Quran text reference
405
+ - **[Sunnah.com](https://sunnah.com)** — Hadith collections reference
406
+
407
+ ---
408
+
409
+ ## 📝 Citation
410
+
411
+ If you use this dataset in your research, please cite:
412
+
413
+ ```bibtex
414
+ @misc{athar-datasets-2026,
415
+ title={Athar: A Multi-Agent Architecture for Grounded Islamic QA},
416
+ author={Kandil, [Author Name]},
417
+ year={2026},
418
+ url={https://huggingface.co/datasets/Kandil7/Athar-Datasets},
419
+ note={Based on the Fanar-Sadiq architecture}
420
+ }
421
+ ```
422
+
423
+ ---
424
+
425
+ ## ⚠️ Usage Notes
426
+
427
+ 1. **Scholarly Context:** These texts represent classical Islamic scholarship. Always consult qualified scholars for religious rulings.
428
+
429
+ 2. **Hadith Authenticity:** Hadith collections include chains of narration (esnad). Use the authenticity grading system to evaluate reliability.
430
+
431
+ 3. **Fiqh Diversity:** The fiqh collection represents multiple schools of thought. Present all views when answering questions.
432
+
433
+ 4. **Language:** Primary content is in Classical Arabic. Metadata includes English translations.
434
+
435
+ 5. **Licensing:** MIT License — free for research and commercial use. Please attribute appropriately.
436
+
437
+ ---
438
+
439
+ ## 📞 Contact & Support
440
+
441
+ - **GitHub:** https://github.com/Kandil7/Athar
442
+ - **Issues:** https://github.com/Kandil7/Athar/issues
443
+ - **HuggingFace:** https://huggingface.co/Kandil7
444
+
445
+ ---
446
+
447
+ <div align="center">
448
+
449
+ **Built with ❤️ for the Muslim community**
450
+
451
+ 🕌 Athar Islamic QA Datasets • 5.7M passages • 8,425 books • 1,400 years of scholarship
452
+
453
+ </div>