abdullah-alamodi commited on
Commit
8d16b5e
ยท
verified ยท
1 Parent(s): 8100b88

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +373 -315
README.md CHANGED
@@ -1,315 +1,373 @@
1
- ---
2
- license: mit
3
- task_categories:
4
- - question-answering
5
- - text-retrieval
6
- language:
7
- - ar
8
- tags:
9
- - aqeedah
10
- - islamic-theology
11
- - arabic
12
- - rag
13
- - faiss
14
- - hybrid-search
15
- size_categories:
16
- - n<1K
17
- pretty_name: Aqeedah RAG Dataset
18
- configs:
19
- - config_name: default
20
- data_files:
21
- - split: train
22
- path: data/train-*
23
- dataset_info:
24
- features:
25
- - name: content
26
- dtype: string
27
- - name: meta
28
- struct:
29
- - name: author_name
30
- dtype: string
31
- - name: doc_name
32
- dtype: string
33
- - name: paragraph_number
34
- dtype: int64
35
- - name: embeddings
36
- list: float64
37
- splits:
38
- - name: train
39
- num_bytes: 43231133
40
- num_examples: 5419
41
- download_size: 30017136
42
- dataset_size: 43231133
43
- ---
44
-
45
-
46
- <div align="center">
47
- <img src="https://upload.wikimedia.org/wikipedia/en/a/ae/Najran_University_Logo.svg" alt="Najran University Logo" width="200"/>
48
-
49
- # Aqeedah RAG Dataset ๐Ÿ“š
50
-
51
- **A Research Initiative by Najran University, Kingdom of Saudi Arabia**
52
- </div>
53
-
54
- ---
55
- # Aqeedah RAG Dataset ๐Ÿ“š
56
-
57
- A curated Arabic Islamic theology (Aqeedah) dataset with pre-computed FAISS embeddings, designed for advanced Retrieval-Augmented Generation (RAG) applications in Islamic scholarly research.
58
-
59
- ## ๐Ÿ“‹ Dataset Description
60
-
61
- This dataset represents a specialized collection of 5419 paragraphs from authoritative Islamic theology texts, meticulously compiled and structured for computational analysis. The corpus focuses specifically on Aqeedah (Islamic creed), covering foundational topics in Islamic belief and theology.
62
-
63
- **Key Features:**
64
- - **Authentic Arabic content** with complete diacritics (Tashkeel) preserved for linguistic accuracy
65
- - **Pre-computed semantic embeddings** (768-dimensional dense vectors) using state-of-the-art Arabic language models
66
- - **Rich scholarly metadata** including source document names, author attributions, and precise paragraph references
67
- - **Optimized FAISS index** for millisecond-scale semantic similarity search
68
- - **Hybrid retrieval support** combining traditional keyword-based (BM25) and modern neural approaches
69
-
70
- ## ๐ŸŽ“ Research Context
71
-
72
- This dataset was developed as part of an academic research initiative at **Najran University, Kingdom of Saudi Arabia**, under the supervision of **Dr. Alya Alamodi**, a distinguished scholar holding a Ph.D. in Islamic Theology (Aqeedah). Dr. Alamodi's expertise in classical Islamic sciences combined with modern computational approaches has shaped the careful curation and theological accuracy of this corpus.
73
-
74
- The technical implementation and AI infrastructure were designed and developed by **Abdullah Alamodi**, M.Sc. candidate in Artificial Intelligence at **IU International University of Applied Sciences, Germany**. This collaboration represents an interdisciplinary effort bridging traditional Islamic scholarship with cutting-edge natural language processing and information retrieval technologies.
75
-
76
- ### Research Objectives
77
-
78
- 1. **Democratizing Access**: Making authoritative Aqeedah knowledge computationally accessible for researchers and students
79
- 2. **Semantic Search**: Enabling meaning-based retrieval beyond keyword matching in classical Arabic texts
80
- 3. **AI-Assisted Learning**: Supporting intelligent question-answering systems for Islamic education
81
- 4. **Scholarly Validation**: Establishing benchmarks for Arabic NLP in religious domain-specific applications
82
-
83
- ## ๐Ÿ“š Source Texts
84
-
85
- This dataset comprises carefully selected paragraphs from the following authoritative Islamic theology works:
86
-
87
- 1. **ุดุฑุญ ุงู„ุทุญุงูˆูŠุฉ** (Sharh al-Tahawiyyah) - ุตุฏุฑ ุงู„ุฏูŠู† ู…ุญู…ุฏ ุจู† ุนู„ุงุก ุงู„ุฏูŠู† ุนู„ูŠ ุจู† ู…ุญู…ุฏ ุงุจู† ุฃุจูŠ ุงู„ุนุฒ ุงู„ุญู†ููŠ (Volumes 1-2)
88
- 2. **ูƒุชุงุจ ุงู„ุชูˆุญูŠุฏ** (Kitab al-Tawhid) - ู…ุญู…ุฏ ุจู† ุนุจุฏ ุงู„ูˆู‡ุงุจ
89
- 3. **ุดุฑุญ ุงู„ุนู‚ูŠุฏุฉ ุงู„ูˆุงุณุทูŠุฉ** (Sharh al-Aqidah al-Wasitiyyah) - ู…ุญู…ุฏ ุจู† ุตุงู„ุญ ุจู† ู…ุญู…ุฏ ุงู„ุนุซูŠู…ูŠู† (Volumes 1-2)
90
- 4. **ุงู„ู‚ูˆู„ ุงู„ู…ููŠุฏ ุนู„ู‰ ูƒุชุงุจ ุงู„ุชูˆุญูŠุฏ** (Al-Qawl al-Mufid 'ala Kitab al-Tawhid) - ู…ุญู…ุฏ ุจู† ุตุงู„ุญ ุจู† ู…ุญู…ุฏ ุงู„ุนุซูŠู…ูŠู† (Volumes 1-4)
91
- 5. **ุงู„ู‚ูˆู„ ุงู„ุณุฏูŠุฏ ุดุฑุญ ูƒุชุงุจ ุงู„ุชูˆุญูŠุฏ** (Al-Qawl al-Sadid Sharh Kitab al-Tawhid) - ุนุจุฏ ุงู„ุฑุญู…ู† ุจู† ู†ุงุตุฑ ุงู„ุณุนุฏูŠ
92
- 6. **ุฃุตูˆู„ ุงู„ุฅูŠู…ุงู†** (Usul al-Iman) - ุนุจุฏ ุงู„ุนุฒูŠุฒ ุจู† ุนุจุฏ ุงู„ู„ู‡ ุจู† ุจุงุฒ
93
- 7. **ุงู„ูˆุฌูŠุฒ ููŠ ุนู‚ูŠุฏุฉ ุงู„ุณู„ู ุงู„ุตุงู„ุญ ุฃู‡ู„ ุงู„ุณู†ุฉ ูˆุงู„ุฌู…ุงุนุฉ** (Al-Wajiz fi Aqidah al-Salaf al-Salih) - ุนุจุฏ ุงู„ู„ู‡ ุจู† ุนุจุฏ ุงู„ุญู…ูŠุฏ ุงู„ุฃุซุฑูŠ
94
- 8. **ุงู„ุฅุณู„ุงู… ุฃุตูˆู„ู‡ ูˆู…ุจุงุฏุฆู‡** (Al-Islam: Usuluhu wa Mabadi'uhu) - ู…ุญู…ุฏ ุจู† ุนุจุฏ ุงู„ู„ู‡ ุจู† ุตุงู„ุญ ุงู„ุณุญูŠู…
95
- 9. **ูุชุงูˆู‰ ู†ูˆุฑ ุนู„ู‰ ุงู„ุฏุฑุจ** (Fatawa Nur 'ala al-Darb) - ู…ุญู…ุฏ ุจู† ุตุงู„ุญ ุจู† ู…ุญู…ุฏ ุงู„ุนุซูŠู…ูŠู† (Volumes 1-4)
96
-
97
- ## ๐Ÿ—‚๏ธ Dataset Structure
98
-
99
- ### Data Fields
100
-
101
- - `paragraph_text` (string): The Arabic text content with complete diacritical marks
102
- - `doc_name` (string): Title of the source Islamic text
103
- - `author_name` (string): Name of the classical or contemporary scholar
104
- - `paragraph_number` (int): Sequential paragraph identifier within the source document
105
- - `embeddings` (list of float): Pre-computed 768-dimensional embedding vector (L2-normalized)
106
-
107
- ### Data Splits
108
-
109
- This dataset contains a single split with 5419 carefully selected paragraphs from verified Islamic theology sources.
110
-
111
- ## ๐Ÿค– Embedding Model
112
-
113
- **Model**: [`aubmindlab/bert-base-arabertv02`](https://huggingface.co/aubmindlab/bert-base-arabertv02)
114
-
115
- **Technical Specifications**:
116
- - Architecture: BERT-Base (12 layers, 768 hidden dimensions)
117
- - Pre-training: Arabic Wikipedia + other Arabic corpora
118
- - Embedding Dimension: 768
119
- - Text Normalization: Light preprocessing (preserves diacritics for theological accuracy)
120
- - Pooling Strategy: Attention-masked average pooling
121
- - Vector Normalization: L2 normalization for cosine similarity compatibility
122
-
123
- ## ๐Ÿš€ Usage
124
-
125
- ### Installation
126
-
127
- ```bash
128
- pip install datasets faiss-cpu torch transformers pyarabic rank-bm25
129
- ```
130
-
131
- ### Quick Start
132
-
133
- ```python
134
- from datasets import load_dataset
135
- import torch
136
- from transformers import AutoTokenizer, AutoModel
137
- import pyarabic.araby as araby
138
-
139
- # Load dataset with FAISS index
140
- dataset = load_dataset("abdullah-alamodi/aqeedah-rag-dataset")
141
-
142
- # Load the embedding model
143
- model_name = "aubmindlab/bert-base-arabertv02"
144
- tokenizer = AutoTokenizer.from_pretrained(model_name)
145
- model = AutoModel.from_pretrained(model_name)
146
-
147
- # Add FAISS index for fast retrieval
148
- dataset['train'].add_faiss_index(column="embeddings")
149
-
150
- # Helper function for embedding
151
- def get_embedding(text):
152
- normalized = araby.normalize_hamza(text)
153
- text_input = f"query: {normalized}"
154
-
155
- inputs = tokenizer([text_input], padding=True, truncation=True,
156
- max_length=512, return_tensors='pt')
157
-
158
- with torch.no_grad():
159
- outputs = model(**inputs)
160
-
161
- # Average pooling
162
- embeddings = outputs.last_hidden_state.mean(dim=1)
163
- embeddings = torch.nn.functional.normalize(embeddings, p=2, dim=1)
164
-
165
- return embeddings[0].numpy()
166
-
167
- # Search example
168
- query = "ู…ุง ู…ุนู†ู‰ ุดู‡ุงุฏุฉ ุฃู† ู„ุง ุฅู„ู‡ ุฅู„ุง ุงู„ู„ู‡ุŸ"
169
- query_embedding = get_embedding(query)
170
-
171
- # Find top 5 similar documents
172
- scores, retrieved = dataset['train'].get_nearest_examples(
173
- "embeddings",
174
- query_embedding,
175
- k=5
176
- )
177
-
178
- # Display results
179
- for score, text, doc, author in zip(
180
- scores,
181
- retrieved['paragraph_text'],
182
- retrieved['doc_name'],
183
- retrieved['author_name']
184
- ):
185
- print(f"Score: {score:.4f}")
186
- print(f"Document: {doc} by {author}")
187
- print(f"Text: {text[:200]}...")
188
- print("-" * 80)
189
- ```
190
-
191
- ### Hybrid Search (BM25 + Dense)
192
-
193
- ```python
194
- from rank_bm25 import BM25Okapi
195
- import numpy as np
196
- import pyarabic.araby as araby
197
-
198
- # Prepare BM25 index
199
- def normalize_for_bm25(text):
200
- text = araby.normalize_hamza(text)
201
- text = araby.strip_diacritics(text)
202
- text = araby.strip_tatweel(text)
203
- return text
204
-
205
- corpus = [normalize_for_bm25(doc['paragraph_text']) for doc in dataset['train']]
206
- tokenized = [doc.split() for doc in corpus]
207
- bm25 = BM25Okapi(tokenized)
208
-
209
- # Search function
210
- def hybrid_search(query, top_k=5):
211
- # BM25 search
212
- norm_query = normalize_for_bm25(query)
213
- bm25_scores = bm25.get_scores(norm_query.split())
214
- bm25_top = np.argsort(bm25_scores)[::-1][:top_k]
215
-
216
- # Dense search
217
- query_emb = get_embedding(query)
218
- scores, faiss_results = dataset['train'].get_nearest_examples(
219
- "embeddings", query_emb, k=top_k
220
- )
221
-
222
- # Combine results using rank fusion
223
- combined_results = # Your fusion logic here
224
-
225
- return combined_results
226
-
227
- # Example usage
228
- results = hybrid_search("ู…ุง ู‡ูŠ ุฃุฑูƒุงู† ุงู„ุฅูŠู…ุงู†ุŸ", top_k=5)
229
- ```
230
-
231
- ## ๐Ÿ“Š Dataset Statistics
232
-
233
- - **Total paragraphs**: 5419
234
- - **Language**: Classical and Modern Standard Arabic (ar)
235
- - **Domain**: Islamic Theology (Aqeedah)
236
- - **Source texts**: 17 volumes from 9 distinct scholarly works
237
- - **Average text length**: ~951 characters per paragraph
238
- - **Embedding coverage**: 100% of corpus
239
-
240
- ## ๐ŸŽฏ Intended Use
241
-
242
- ### Primary Applications
243
-
244
- - โœ… **Scholarly RAG Systems**: Building question-answering systems for Islamic theology education
245
- - โœ… **Semantic Search**: Enabling meaning-based retrieval in classical Arabic religious texts
246
- - โœ… **Educational Technology**: Supporting AI-powered learning platforms for Aqeedah studies
247
- - โœ… **Research Tools**: Facilitating computational analysis of Islamic theological discourse
248
-
249
- ### Research Domains
250
-
251
- - Arabic Natural Language Processing (NLP)
252
- - Information Retrieval in Religious Texts
253
- - Cross-lingual Semantic Search
254
- - Domain-Specific Language Models
255
-
256
- ## โš ๏ธ Limitations & Considerations
257
-
258
- ### Scope Limitations
259
- - **Domain Specificity**: Exclusively focused on Islamic theology (Aqeedah); not suitable for general Arabic NLP tasks
260
- - **Language**: Limited to Arabic; no multilingual support
261
- - **Corpus Size**: 5419 paragraphs represent a focused collection, not exhaustive coverage of all Aqeedah literature
262
- - **Temporal Coverage**: Focuses on established scholarly works; may not include the most recent publications
263
-
264
- ### Theological Considerations
265
- - This dataset is curated for academic and educational purposes
266
- - Users should consult qualified Islamic scholars for authoritative religious guidance
267
- - The dataset represents specific theological perspectives within Sunni Islamic tradition (Ahl al-Sunnah wa al-Jama'ah)
268
-
269
- ### Technical Limitations
270
- - Embeddings are model-specific (AraBERT v2); transfer to other models may require re-encoding
271
- - FAISS index optimized for CPU inference; GPU acceleration requires additional configuration
272
- - Diacritic preservation may affect compatibility with some NLP tools trained on non-diacritized text
273
-
274
- ## ๐Ÿ“œ License
275
-
276
- **MIT License** - This dataset is freely available for academic research, educational purposes, and commercial applications with proper attribution.
277
-
278
- ## ๐Ÿ™ Citation
279
-
280
- If you use this dataset in your research or applications, please cite:
281
-
282
- ```bibtex
283
- @dataset{aqeedah_rag_dataset_2025,
284
- title={Aqeedah RAG Dataset: Arabic Islamic Theology Corpus with Pre-computed Embeddings},
285
- author={Alamodi, Alya and Alamodi, Abdullah},
286
- year={2025},
287
- institution={Najran University, Saudi Arabia},
288
- publisher={Hugging Face},
289
- howpublished={\url{https://huggingface.co/datasets/abdullah-alamodi/aqeedah-rag-dataset}},
290
- note={Curated by Dr. Alya Alamodi (Najran University), Technical Implementation by Abdullah Alamodi (IU International University of Applied Sciences)}
291
- }
292
- ```
293
-
294
- ## ๐Ÿ‘ฅ Contributors
295
-
296
- **Principal Investigator & Theological Curation:**
297
- **Dr. Alya Alamodi**
298
- Ph.D. in Islamic Theology (Aqeedah)
299
- Najran University, Kingdom of Saudi Arabia
300
-
301
- **Technical Development & AI Implementation:**
302
- **Abdullah Alamodi**
303
- M.Sc. Candidate in Artificial Intelligence
304
- IU International University of Applied Sciences, Germany
305
-
306
- ## ๐Ÿ“ง Contact
307
-
308
- For questions regarding:
309
- - **Theological content and scholarly interpretation**: Contact Dr. Alya Alamodi via Najran University
310
- - **Technical implementation and AI methodology**: Contact Abdullah Alamodi
311
- - **General inquiries**: Open an issue on the dataset repository
312
-
313
- ---
314
-
315
- **Acknowledgments**: This work was supported by the academic resources of Najran University and developed with computational infrastructure provided by IU International University of Applied Sciences.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - question-answering
5
+ - text-retrieval
6
+ language:
7
+ - ar
8
+ tags:
9
+ - aqeedah
10
+ - islamic-theology
11
+ - arabic
12
+ - rag
13
+ - faiss
14
+ - hybrid-search
15
+ size_categories:
16
+ - n<1K
17
+ pretty_name: Aqeedah RAG Dataset
18
+ configs:
19
+ - config_name: default
20
+ data_files:
21
+ - split: train
22
+ path: data/train-*
23
+ dataset_info:
24
+ features:
25
+ - name: content
26
+ dtype: string
27
+ - name: meta
28
+ struct:
29
+ - name: author_name
30
+ dtype: string
31
+ - name: doc_name
32
+ dtype: string
33
+ - name: paragraph_number
34
+ dtype: int64
35
+ - name: embeddings
36
+ list: float64
37
+ splits:
38
+ - name: train
39
+ num_bytes: 43231133
40
+ num_examples: 5419
41
+ download_size: 30017136
42
+ dataset_size: 43231133
43
+ ---
44
+
45
+
46
+ <div align="center">
47
+ <img src="https://upload.wikimedia.org/wikipedia/en/a/ae/Najran_University_Logo.svg" alt="Najran University Logo" width="200"/>
48
+
49
+ # Aqeedah RAG Dataset ๐Ÿ“š
50
+
51
+ **A Research Initiative by Najran University, Kingdom of Saudi Arabia**
52
+ </div>
53
+
54
+ ---
55
+ # Aqeedah RAG Dataset ๐Ÿ“š
56
+
57
+ A curated Arabic Islamic theology (Aqeedah) dataset with pre-computed FAISS embeddings, designed for advanced Retrieval-Augmented Generation (RAG) applications in Islamic scholarly research.
58
+
59
+ ## ๐Ÿ“‹ Dataset Description
60
+
61
+ This dataset represents a specialized collection of 5419 paragraphs from authoritative Islamic theology texts, meticulously compiled and structured for computational analysis. The corpus focuses specifically on Aqeedah (Islamic creed), covering foundational topics in Islamic belief and theology.
62
+
63
+ **Key Features:**
64
+ - **Authentic Arabic content** with complete diacritics (Tashkeel) preserved for linguistic accuracy
65
+ - **Pre-computed semantic embeddings** (768-dimensional dense vectors) using state-of-the-art Arabic language models
66
+ - **Rich scholarly metadata** including source document names, author attributions, and precise paragraph references
67
+ - **Optimized FAISS index** for millisecond-scale semantic similarity search
68
+ - **Hybrid retrieval support** combining traditional keyword-based (BM25) and modern neural approaches
69
+
70
+ ## ๐ŸŽ“ Research Context
71
+
72
+ This dataset was developed as part of an academic research initiative at **Najran University, Kingdom of Saudi Arabia**, under the supervision of **Dr. Alya Alamodi**, a distinguished scholar holding a Ph.D. in Islamic Theology (Aqeedah). Dr. Alamodi's expertise in classical Islamic sciences combined with modern computational approaches has shaped the careful curation and theological accuracy of this corpus.
73
+
74
+ The technical implementation and AI infrastructure were designed and developed by **Abdullah Alamodi**, M.Sc. candidate in Artificial Intelligence at **IU International University of Applied Sciences, Germany**. This collaboration represents an interdisciplinary effort bridging traditional Islamic scholarship with cutting-edge natural language processing and information retrieval technologies.
75
+
76
+ ### Research Objectives
77
+
78
+ 1. **Democratizing Access**: Making authoritative Aqeedah knowledge computationally accessible for researchers and students
79
+ 2. **Semantic Search**: Enabling meaning-based retrieval beyond keyword matching in classical Arabic texts
80
+ 3. **AI-Assisted Learning**: Supporting intelligent question-answering systems for Islamic education
81
+ 4. **Scholarly Validation**: Establishing benchmarks for Arabic NLP in religious domain-specific applications
82
+
83
+ ## ๐Ÿ“š Source Texts
84
+
85
+ This dataset comprises carefully selected paragraphs from the following authoritative Islamic theology works:
86
+
87
+ 1. **ุดุฑุญ ุงู„ุทุญุงูˆูŠุฉ** (Sharh al-Tahawiyyah) - ุตุฏุฑ ุงู„ุฏูŠู† ู…ุญู…ุฏ ุจู† ุนู„ุงุก ุงู„ุฏูŠู† ุนู„ูŠ ุจู† ู…ุญู…ุฏ ุงุจู† ุฃุจูŠ ุงู„ุนุฒ ุงู„ุญู†ููŠ (Volumes 1-2)
88
+ 2. **ูƒุชุงุจ ุงู„ุชูˆุญูŠุฏ** (Kitab al-Tawhid) - ู…ุญู…ุฏ ุจู† ุนุจุฏ ุงู„ูˆู‡ุงุจ
89
+ 3. **ุดุฑุญ ุงู„ุนู‚ูŠุฏุฉ ุงู„ูˆุงุณุทูŠุฉ** (Sharh al-Aqidah al-Wasitiyyah) - ู…ุญู…ุฏ ุจู† ุตุงู„ุญ ุจู† ู…ุญู…ุฏ ุงู„ุนุซูŠู…ูŠู† (Volumes 1-2)
90
+ 4. **ุงู„ู‚ูˆู„ ุงู„ู…ููŠุฏ ุนู„ู‰ ูƒุชุงุจ ุงู„ุชูˆุญูŠุฏ** (Al-Qawl al-Mufid 'ala Kitab al-Tawhid) - ู…ุญู…ุฏ ุจู† ุตุงู„ุญ ุจู† ู…ุญู…ุฏ ุงู„ุนุซูŠู…ูŠู† (Volumes 1-4)
91
+ 5. **ุงู„ู‚ูˆู„ ุงู„ุณุฏูŠุฏ ุดุฑุญ ูƒุชุงุจ ุงู„ุชูˆุญูŠุฏ** (Al-Qawl al-Sadid Sharh Kitab al-Tawhid) - ุนุจุฏ ุงู„ุฑุญู…ู† ุจู† ู†ุงุตุฑ ุงู„ุณุนุฏูŠ
92
+ 6. **ุฃุตูˆู„ ุงู„ุฅูŠู…ุงู†** (Usul al-Iman) - ุนุจุฏ ุงู„ุนุฒูŠุฒ ุจู† ุนุจุฏ ุงู„ู„ู‡ ุจู† ุจุงุฒ
93
+ 7. **ุงู„ูˆุฌูŠุฒ ููŠ ุนู‚ูŠุฏุฉ ุงู„ุณู„ู ุงู„ุตุงู„ุญ ุฃู‡ู„ ุงู„ุณู†ุฉ ูˆุงู„ุฌู…ุงุนุฉ** (Al-Wajiz fi Aqidah al-Salaf al-Salih) - ุนุจุฏ ุงู„ู„ู‡ ุจู† ุนุจุฏ ุงู„ุญู…ูŠุฏ ุงู„ุฃุซุฑูŠ
94
+ 8. **ุงู„ุฅุณู„ุงู… ุฃุตูˆู„ู‡ ูˆู…ุจุงุฏุฆู‡** (Al-Islam: Usuluhu wa Mabadi'uhu) - ู…ุญู…ุฏ ุจู† ุนุจุฏ ุงู„ู„ู‡ ุจู† ุตุงู„ุญ ุงู„ุณุญูŠู…
95
+ 9. **ูุชุงูˆู‰ ู†ูˆุฑ ุนู„ู‰ ุงู„ุฏุฑุจ** (Fatawa Nur 'ala al-Darb) - ู…ุญู…ุฏ ุจู† ุตุงู„ุญ ุจู† ู…ุญู…ุฏ ุงู„ุนุซูŠู…ูŠู† (Volumes 1-4)
96
+
97
+ ## ๐Ÿ—‚๏ธ Dataset Structure
98
+
99
+ ### Data Fields
100
+
101
+ - `paragraph_text` (string): The Arabic text content with complete diacritical marks
102
+ - `doc_name` (string): Title of the source Islamic text
103
+ - `author_name` (string): Name of the classical or contemporary scholar
104
+ - `paragraph_number` (int): Sequential paragraph identifier within the source document
105
+ - `embeddings` (list of float): Pre-computed 768-dimensional embedding vector (L2-normalized)
106
+
107
+ ### Data Splits
108
+
109
+ This dataset contains a single split with 5419 carefully selected paragraphs from verified Islamic theology sources.
110
+
111
+ ## ๐Ÿค– Embedding Model
112
+
113
+ **Model**: [`aubmindlab/bert-base-arabertv02`](https://huggingface.co/aubmindlab/bert-base-arabertv02)
114
+
115
+ **Technical Specifications**:
116
+ - Architecture: BERT-Base (12 layers, 768 hidden dimensions)
117
+ - Pre-training: Arabic Wikipedia + other Arabic corpora
118
+ - Embedding Dimension: 768
119
+ - Text Normalization: Light preprocessing (preserves diacritics for theological accuracy)
120
+ - Pooling Strategy: Attention-masked average pooling
121
+ - Vector Normalization: L2 normalization for cosine similarity compatibility
122
+
123
+ ## ๐Ÿš€ Usage
124
+
125
+ ### Installation
126
+
127
+ ```bash
128
+ pip install datasets faiss-cpu torch transformers pyarabic rank-bm25
129
+ ```
130
+
131
+ ### Quick Start
132
+
133
+ ```python
134
+ from datasets import load_dataset
135
+ import torch
136
+ from transformers import AutoTokenizer, AutoModel
137
+ import pyarabic.araby as araby
138
+
139
+ # Load dataset with FAISS index
140
+ dataset = load_dataset("abdullah-alamodi/aqeedah-rag-dataset")
141
+
142
+ # Load the embedding model
143
+ model_name = "aubmindlab/bert-base-arabertv02"
144
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
145
+ model = AutoModel.from_pretrained(model_name)
146
+
147
+ # Add FAISS index for fast retrieval
148
+ dataset['train'].add_faiss_index(column="embeddings")
149
+
150
+ # Helper function for embedding
151
+ def get_embedding(text):
152
+ normalized = araby.normalize_hamza(text)
153
+ text_input = f"query: {normalized}"
154
+
155
+ inputs = tokenizer([text_input], padding=True, truncation=True,
156
+ max_length=512, return_tensors='pt')
157
+
158
+ with torch.no_grad():
159
+ outputs = model(**inputs)
160
+
161
+ # Average pooling
162
+ embeddings = outputs.last_hidden_state.mean(dim=1)
163
+ embeddings = torch.nn.functional.normalize(embeddings, p=2, dim=1)
164
+
165
+ return embeddings[0].numpy()
166
+
167
+ # Search example
168
+ query = "ู…ุง ู…ุนู†ู‰ ุดู‡ุงุฏุฉ ุฃู† ู„ุง ุฅู„ู‡ ุฅู„ุง ุงู„ู„ู‡ุŸ"
169
+ query_embedding = get_embedding(query)
170
+
171
+ # Find top 5 similar documents
172
+ scores, retrieved = dataset['train'].get_nearest_examples(
173
+ "embeddings",
174
+ query_embedding,
175
+ k=5
176
+ )
177
+
178
+ # Display results
179
+ for i, (score, text, meta) in enumerate(zip(
180
+ scores,
181
+ retrieved['content'],
182
+ retrieved['meta']
183
+ )):
184
+ print(f"ุงู„ู†ุต ุงู„ู…ุณุชุฑุฌุน ู„ู„ุณุคุงู„ {i+1}".center(80, '-'))
185
+ print(f"Score: {score:.4f}")
186
+ print(f"Document: {meta['doc_name']} by {meta['author_name']}")
187
+ print(f"Paragraph: {meta['paragraph_number']}")
188
+ print(f"Text: {text[:200]}...")
189
+ print("\n")
190
+ ```
191
+
192
+ ### Hybrid Search (BM25 + Dense)
193
+
194
+ ```python
195
+ from rank_bm25 import BM25Okapi
196
+ import numpy as np
197
+ import pyarabic.araby as araby
198
+ from datasets import load_dataset
199
+ from transformers import AutoTokenizer, AutoModel
200
+ import torch
201
+
202
+ # Load dataset with FAISS index
203
+ dataset = load_dataset("abdullah-alamodi/aqeedah-rag-dataset")
204
+
205
+ # Load the embedding model
206
+ model_name = "aubmindlab/bert-base-arabertv02"
207
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
208
+ model = AutoModel.from_pretrained(model_name)
209
+
210
+ # Add FAISS index for fast retrieval
211
+ dataset['train'].add_faiss_index(column="embeddings")
212
+
213
+ # Helper function for embedding
214
+ def get_embedding(text):
215
+ normalized = araby.normalize_hamza(text)
216
+ text_input = f"query: {normalized}"
217
+
218
+ inputs = tokenizer([text_input], padding=True, truncation=True,
219
+ max_length=512, return_tensors='pt')
220
+
221
+ with torch.no_grad():
222
+ outputs = model(**inputs)
223
+
224
+ # Average pooling
225
+ embeddings = outputs.last_hidden_state.mean(dim=1)
226
+ embeddings = torch.nn.functional.normalize(embeddings, p=2, dim=1)
227
+
228
+ return embeddings[0].numpy()
229
+
230
+ # Prepare BM25 index
231
+ def normalize_for_bm25(text):
232
+ text = araby.normalize_hamza(text)
233
+ text = araby.strip_diacritics(text)
234
+ text = araby.strip_tatweel(text)
235
+ return text
236
+
237
+ corpus = [normalize_for_bm25(doc['content']) for doc in dataset['train']]
238
+ tokenized = [doc.split() for doc in corpus]
239
+ bm25 = BM25Okapi(tokenized)
240
+
241
+ # Search function
242
+ def hybrid_search(query, top_k=5):
243
+ # BM25 search
244
+ norm_query = normalize_for_bm25(query)
245
+ bm25_scores = bm25.get_scores(norm_query.split())
246
+ bm25_top = np.argsort(bm25_scores)[::-1][:top_k]
247
+
248
+ # Dense search
249
+ query_emb = get_embedding(query)
250
+ scores, faiss_results = dataset['train'].get_nearest_examples(
251
+ "embeddings", query_emb, k=top_k
252
+ )
253
+
254
+ # Extract FAISS indices (they're already sorted by score)
255
+ # Since get_nearest_examples returns actual data, we need to track indices differently
256
+ # Simple approach: just combine the unique results
257
+
258
+ # Get unique indices from both methods
259
+ bm25_indices = set(bm25_top.tolist())
260
+
261
+ # For FAISS, we'll use the returned results directly
262
+ # Combine: prioritize FAISS results, then add BM25-only results
263
+ combined_results = []
264
+ seen_content = set()
265
+
266
+ # Add FAISS results first
267
+ for content, meta in zip(faiss_results['content'], faiss_results['meta']):
268
+ if content not in seen_content:
269
+ combined_results.append({'content': content, 'meta': meta})
270
+ seen_content.add(content)
271
+
272
+ # Add unique BM25 results
273
+ for idx in bm25_top:
274
+ doc = dataset['train'][int(idx)]
275
+ if doc['content'] not in seen_content:
276
+ combined_results.append(doc)
277
+ seen_content.add(doc['content'])
278
+ if len(combined_results) >= top_k * 2: # Get up to 2x results
279
+ break
280
+
281
+ return combined_results[:top_k * 2] # Return more results for better coverage
282
+
283
+ # Example usage
284
+ results = hybrid_search("ู…ุง ู‡ูŠ ุฃุฑูƒุงู† ุงู„ุฅูŠู…ุงู†ุŸ", top_k=5)
285
+ for i, res in enumerate(results):
286
+ print(f"Result {i+1}: {res['content']}\n")
287
+ ```
288
+
289
+ ## ๐Ÿ“Š Dataset Statistics
290
+
291
+ - **Total paragraphs**: 5419
292
+ - **Language**: Classical and Modern Standard Arabic (ar)
293
+ - **Domain**: Islamic Theology (Aqeedah)
294
+ - **Source texts**: 17 volumes from 9 distinct scholarly works
295
+ - **Average text length**: ~951 characters per paragraph
296
+ - **Embedding coverage**: 100% of corpus
297
+
298
+ ## ๐ŸŽฏ Intended Use
299
+
300
+ ### Primary Applications
301
+
302
+ - โœ… **Scholarly RAG Systems**: Building question-answering systems for Islamic theology education
303
+ - โœ… **Semantic Search**: Enabling meaning-based retrieval in classical Arabic religious texts
304
+ - โœ… **Educational Technology**: Supporting AI-powered learning platforms for Aqeedah studies
305
+ - โœ… **Research Tools**: Facilitating computational analysis of Islamic theological discourse
306
+
307
+ ### Research Domains
308
+
309
+ - Arabic Natural Language Processing (NLP)
310
+ - Information Retrieval in Religious Texts
311
+ - Cross-lingual Semantic Search
312
+ - Domain-Specific Language Models
313
+
314
+ ## โš ๏ธ Limitations & Considerations
315
+
316
+ ### Scope Limitations
317
+ - **Domain Specificity**: Exclusively focused on Islamic theology (Aqeedah); not suitable for general Arabic NLP tasks
318
+ - **Language**: Limited to Arabic; no multilingual support
319
+ - **Corpus Size**: 5419 paragraphs represent a focused collection, not exhaustive coverage of all Aqeedah literature
320
+ - **Temporal Coverage**: Focuses on established scholarly works; may not include the most recent publications
321
+
322
+ ### Theological Considerations
323
+ - This dataset is curated for academic and educational purposes
324
+ - Users should consult qualified Islamic scholars for authoritative religious guidance
325
+ - The dataset represents specific theological perspectives within Sunni Islamic tradition (Ahl al-Sunnah wa al-Jama'ah)
326
+
327
+ ### Technical Limitations
328
+ - Embeddings are model-specific (AraBERT v2); transfer to other models may require re-encoding
329
+ - FAISS index optimized for CPU inference; GPU acceleration requires additional configuration
330
+ - Diacritic preservation may affect compatibility with some NLP tools trained on non-diacritized text
331
+
332
+ ## ๐Ÿ“œ License
333
+
334
+ **MIT License** - This dataset is freely available for academic research, educational purposes, and commercial applications with proper attribution.
335
+
336
+ ## ๐Ÿ™ Citation
337
+
338
+ If you use this dataset in your research or applications, please cite:
339
+
340
+ ```bibtex
341
+ @dataset{aqeedah_rag_dataset_2025,
342
+ title={Aqeedah RAG Dataset: Arabic Islamic Theology Corpus with Pre-computed Embeddings},
343
+ author={Alamodi, Alya and Alamodi, Abdullah},
344
+ year={2025},
345
+ institution={Najran University, Saudi Arabia},
346
+ publisher={Hugging Face},
347
+ howpublished={\url{https://huggingface.co/datasets/abdullah-alamodi/aqeedah-rag-dataset}},
348
+ note={Curated by Dr. Alya Alamodi (Najran University), Technical Implementation by Abdullah Alamodi (IU International University of Applied Sciences)}
349
+ }
350
+ ```
351
+
352
+ ## ๐Ÿ‘ฅ Contributors
353
+
354
+ **Principal Investigator & Theological Curation:**
355
+ **Dr. Alya Alamodi**
356
+ Ph.D. in Islamic Theology (Aqeedah)
357
+ Najran University, Kingdom of Saudi Arabia
358
+
359
+ **Technical Development & AI Implementation:**
360
+ **Abdullah Alamodi**
361
+ M.Sc. Candidate in Artificial Intelligence
362
+ IU International University of Applied Sciences, Germany
363
+
364
+ ## ๐Ÿ“ง Contact
365
+
366
+ For questions regarding:
367
+ - **Theological content and scholarly interpretation**: Contact Dr. Alya Alamodi via Najran University
368
+ - **Technical implementation and AI methodology**: Contact Abdullah Alamodi
369
+ - **General inquiries**: Open an issue on the dataset repository
370
+
371
+ ---
372
+
373
+ **Acknowledgments**: This work was supported by the academic resources of Najran University and developed with computational infrastructure provided by IU International University of Applied Sciences.