input_ids list | attention_mask list |
|---|---|
[
30350,
214854,
25,
174721,
148640,
74631,
44060,
161203,
148424,
152686,
148469,
220,
19,
198,
149650,
148404,
148641,
25,
155114,
201830,
198,
150133,
40218,
157523,
25,
44060,
161203,
153229,
198,
179415,
157674,
25,
174721,
148640,
74631,
4406... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
79259,
16,
8,
471,
61272,
148666,
10748,
160438,
88199,
90322,
241148,
148483,
65931,
148391,
12940,
318,
40218,
25,
220,
17,
15,
15,
66459,
26942,
148447,
195426,
148441,
154160,
148439,
162295,
8,
271,
58,
36138,
220,
17,
60,
198,
148559,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
159717,
151189,
27004,
66459,
51909,
195219,
151003,
27004,
148784,
148515,
15682,
62422,
42526,
150112,
57392,
15682,
62422,
75045,
155815,
27004,
25,
79333,
184428,
27004,
51909,
180251,
160844,
154876,
82215,
152702,
155973,
51909,
156312,
157863,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
151091,
57392,
148282,
150021,
36281,
155815,
8270,
148515,
15682,
62422,
42526,
149331,
155973,
83941,
160844,
151618,
50406,
151091,
57392,
148299,
153071,
75045,
155572,
216840,
154876,
318,
18,
24,
8866,
498,
150133,
153867,
25,
18,
23,
66459... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
148911,
63191,
271,
58,
36138,
220,
20,
60,
198,
150741,
68216,
149071,
185909,
160850,
28,
151551,
150099,
153650,
88199,
74631,
239787,
148358,
220025,
151476,
31704,
152686,
70943,
150741,
68216,
239030,
160850,
28,
148559,
148584,
244066,
516... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
160628,
161452,
220,
16,
19,
18,
18,
54017,
148650,
211875,
54895,
220,
16,
23,
14,
220,
18,
14,
17,
15,
16,
17,
187411,
8270,
196393,
220,
16,
17,
51909,
172990,
220,
16,
19,
18,
18,
54017,
148650,
211875,
54895,
220,
18,
16,
14,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
148415,
159443,
51909,
221442,
159189,
65931,
148948,
20704,
151412,
148918,
148584,
61102,
185043,
149189,
70783,
148798,
30055,
148382,
170040,
170117,
218858,
159189,
151684,
26598,
175243,
149189,
150097,
194197,
148382,
169838,
174622,
184532,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
192903,
61102,
148424,
148497,
154313,
148459,
159657,
181106,
68216,
156830,
171580,
66459,
169875,
42526,
149339,
148825,
149438,
189051,
150732,
224192,
170469,
149189,
195726,
159729,
148581,
155025,
194872,
51686,
149420,
154313,
13,
318,
79259,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
71263,
187829,
153071,
61102,
57392,
148581,
57392,
169875,
149505,
57392,
148828,
15682,
66459,
44060,
151045,
148382,
156002,
57392,
153741,
148304,
155093,
155102,
201211,
170884,
148469,
152776,
16660,
194326,
31993,
159717,
38128,
149544,
204361,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
148581,
57392,
169936,
156846,
53477,
210676,
148304,
30055,
155271,
71263,
160692,
71263,
149650,
148290,
26942,
148975,
150037,
148784,
180157,
152230,
57392,
148997,
148304,
66459,
44060,
148975,
150037,
148784,
180157,
148599,
9873,
180964,
154876,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
152322,
208523,
155025,
174008,
149013,
153845,
150643,
152301,
66459,
208523,
155025,
170186,
183153,
151604,
159189,
183718,
150667,
159189,
162807,
15682,
175288,
13,
175117,
148631,
148908,
75045,
148308,
31704,
66459,
61272,
156637,
175272,
245534... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
148784,
180157,
148487,
71263,
28850,
57392,
148452,
148487,
71263,
28850,
148542,
154463,
150055,
57392,
164547,
154876,
61102,
148487,
71263,
28850,
57392,
148452,
148487,
71263,
28850,
148542,
13,
175334,
154876,
222022,
71263,
153320,
57392,
1484... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
149079,
57392,
160620,
66459,
198123,
149510,
180157,
196569,
71263,
155093,
66459,
44060,
153830,
170241,
61272,
150027,
151715,
156101,
153071,
66459,
181196,
25,
151401,
57392,
152305,
71263,
150266,
71263,
75045,
12290,
160010,
30055,
187586,
148... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
200456,
171580,
66459,
170583,
25,
246297,
22500,
57392,
149393,
155102,
201211,
155674,
30055,
178823,
66459,
212466,
161104,
198123,
178823,
66459,
170583,
25,
170040,
57823,
28850,
159717,
154876,
154013,
57392,
149654,
195726,
57392,
149654,
1568... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
176118,
471,
172661,
148581,
158371,
159961,
66459,
159596,
56674,
148581,
156776,
148698,
66459,
170370,
151023,
148792,
175243,
148950,
148342,
20704,
187037,
151492,
26598,
151045,
15682,
66459,
171087,
155025,
185585,
155284,
148581,
159058,
170241... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
54895,
150164,
152432,
201120,
66459,
237591,
160098,
471,
74631,
152344,
173240,
15682,
160654,
149001,
148441,
149025,
471,
149189,
171821,
155093,
203084,
46044,
201120,
155114,
203084,
46044,
51686,
180851,
149432,
13,
61102,
197225,
150747,
1490... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
154160,
171550,
66459,
160437,
71263,
153448,
57392,
230649,
211355,
154876,
66459,
160437,
180157,
197352,
154876,
169838,
149189,
57392,
171241,
57392,
152375,
74631,
148581,
57392,
171165,
57392,
155922,
151492,
53477,
161776,
13,
159587,
148382,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
57392,
152375,
170162,
169838,
148599,
9873,
180964,
153071,
66459,
44060,
148956,
78178,
148536,
61102,
57392,
149189,
57392,
154013,
57392,
148452,
148382,
78948,
66459,
152171,
151531,
204361,
153278,
180606,
57392,
40218,
163208,
66459,
222535,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
230593,
168181,
42526,
228561,
154876,
156844,
148290,
154876,
12620,
5074,
20704,
148282,
19453,
148360,
178470,
82065,
5525,
78948,
235272,
149189,
156846,
20291,
82065,
5525,
2423,
171737,
149510,
170040,
148543,
149544,
170186,
149071,
148452,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
152033,
153278,
8270,
151424,
170754,
170040,
148631,
176584,
148382,
149828,
149189,
149828,
154412,
148452,
148304,
172520,
149189,
152375,
153531,
149828,
152033,
70330,
9873,
194221,
170105,
159138,
227534,
164453,
159614,
13,
150079,
159064,
16171... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
150289,
57392,
151684,
57392,
179649,
148382,
148599,
9873,
71263,
148698,
148536,
169838,
155025,
61272,
193209,
66459,
159839,
57392,
154400,
57392,
42190,
148404,
148382,
160945,
57392,
149189,
71263,
155025,
181659,
53208,
170162,
148599,
9873,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
12290,
61272,
160815,
148342,
169936,
194015,
155558,
66459,
222536,
229838,
195315,
152358,
169936,
162411,
203917,
66459,
222536,
229838,
152370,
188357,
169936,
184188,
70330,
0,
12290,
148581,
169936,
233190,
148304,
159158,
174876,
148945,
15682,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
[
18,
15,
60,
198,
11460,
151500,
148473,
61102,
174082,
148426,
236532,
154313,
210095,
148595,
148290,
175305,
148335,
220534,
237177,
161049,
13,
187520,
74631,
153163,
160248,
171241,
40218,
159598,
148581,
169838,
155638,
151412,
195787,
148290,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
- A large-scale tokenized corpus of Arabic Islamic texts from the Shamela Library, pre-tokenized and ready for training Arabic language models and building RAG (Retrieval-Augmented Generation) systems.
This is the first batch—comprising about 521 books out of a total of 35,000 and I will be adding them successively.
- 📊 Statistics
- 🗂️ Data Structure
- 📚 Categories
- 📖 Sample Books All books are defined in a file Book.txt
- 📁 File-to-Category Mapping
- 🔗 Related Repositories
- The original texts are sourced from the Shamela Library Official Library: goldenshamela
3arabLM-corpus
A large-scale tokenized corpus of Arabic Islamic texts from the Shamela Library, pre-tokenized and ready for training Arabic language models and building RAG (Retrieval-Augmented Generation) systems. This is the first batch—comprising about 521 books out of a total of 35,000 and I will be adding them successively.
📊 Statistics
| Metric | Value |
|---|---|
| Number of files | 47 Parquet files |
| Total rows (chunks) | 2,209,875 |
| Sequence length | 1,024 tokens per chunk |
| Total tokens | ≈ 2,262,912,000 (2.26B) |
| Total size | ~3.07 GB |
| Unique books | 521+ |
| Categories | 8 main categories |
| Language | Modern Standard Arabic (classical Islamic texts) |
🗂️ Data Structure
Each Parquet file contains only two columns (since texts are pre-tokenized):
| Column | Type | Description |
|---|---|---|
input_ids |
list<int32> |
1,024 token IDs per row |
attention_mask |
list<int8> |
1 for real tokens, 0 for padding |
Tokenizer
- Path:
finsh/v2(from modelsherif1313/3arabLM-4B-islamic-v2) - Vocabulary size: 248,044
- EOS token ID: 248,044
- PAD token ID: 248,044
📚 Categories
| Category | Approximate Share |
|---|---|
| Tafsir (Quranic Exegesis) | 56% |
| Hadith Texts | 22% |
| Fatwas (Islamic Rulings) | 7% |
| General Fiqh (Jurisprudence) | 5% |
| Ibn Taymiyyah's Works | 4% |
| Arabic Grammar & Morphology | 2% |
| Aqeedah (Creed) | 2% |
| Ibn al-Qayyim's Works | 1% |
📖 Sample Books All books are defined in a file Book.txt
General Fiqh
- Al-Mufassal fi Fiqh al-Jihad
- Al-Fiqh al-Islami wa Adillatuh (Al-Zuhayli)
- Al-Muhalla bil-Athar
- Kuwaiti Fiqh Encyclopedia
- Fiqh al-Sunnah
- Fiqh ala al-Madhahib al-Arba'a
Fatwas
- Fatwas of the Permanent Committee - Vol 1
- Fatwas of the Permanent Committee - Vol 2
- Nur ala al-Darb Fatwas (Ibn Baz)
- Majmu' Fatawa wa Rasa'il al-Uthaymeen
- Majmu' Fatawa Ibn Baz
- Fatwas of the Islamic Network
- Islam Question and Answer Website
Ibn Taymiyyah's Works
- Majmu' al-Fatawa
- Al-Jawab al-Sahih
- Al-Furqan bayna Awliya' al-Rahman wa Awliya' al-Shaytan
- Al-Risalah al-Arshiyyah
- Al-Safadiyyah
- Al-Mustadrak ala Majmu' al-Fatawa
Ibn al-Qayyim's Works
- I'lam al-Muwaqqi'in
- Bada'i' al-Fawa'id
- Madarij al-Salikin
- Zad al-Ma'ad
- Al-Tibb al-Nabawi
- Al-Wabil al-Sayyib
- Al-Da' wa al-Dawa'
Tafsir (Quranic Exegesis)
- Tafsir al-Tabari
- Tafsir al-Qurtubi
- Tafsir Ibn Kathir
- Tafsir al-Razi (Mafatih al-Ghayb)
- Al-Bahr al-Madid
- Al-Durr al-Manthur
- Fi Zilal al-Quran
- Al-Tahrir wa al-Tanwir
Hadith Texts
- Sahih al-Bukhari
- Sahih Muslim
- Sunan al-Tirmidhi
- Sunan al-Darimi
- Musnad Ahmad
- Al-Sunan al-Kubra (Al-Bayhaqi)
- Al-Mu'jam al-Kabir (Al-Tabarani)
Arabic Grammar & Morphology
- Al-Nahw al-Wafi
- Sharh al-Ashmouni
- Awdah al-Masalik
- Sharh al-Mufassal (Ibn Ya'ish)
- Al-Khasa'is
- Ham' al-Hawami'
Aqeedah (Creed)
- Hayat al-Khidr wa Mawtuh
- Al-Jami' li Shu'ab al-Iman
- Risalah fi Haqiqat al-Ta'wil
- Al-Iman bil-Qadar
- Al-Mawaqif (Al-Iji)
📁 File-to-Category Mapping
Each Parquet file corresponds to one or more books. Since books are packed sequentially,
files marked with ↳ are continuations of the previous file's book (no new book header at the start).
| File | Category |
|---|---|
packed_ids_0000.parquet |
فقه عام (General Fiqh) |
packed_ids_0001.parquet |
فقه عام (General Fiqh) |
packed_ids_0002.parquet |
فقه عام (General Fiqh) |
packed_ids_0003.parquet |
الفتاوى (Fatwas) |
packed_ids_0004.parquet |
الفتاوى (Fatwas) |
packed_ids_0005.parquet |
↳ الفتاوى (continuation) |
packed_ids_0006.parquet |
كتب ابن القيم (Ibn al-Qayyim) |
packed_ids_0007.parquet |
كتب ابن تيمية (Ibn Taymiyyah) |
packed_ids_0008.parquet |
كتب ابن تيمية (Ibn Taymiyyah) |
packed_ids_0009.parquet |
النحو والصرف (Grammar & Morphology) |
packed_ids_0010.parquet |
↳ النحو والصرف (continuation) |
packed_ids_0011.parquet |
التفاسير (Tafsir) |
packed_ids_0012.parquet |
↳ التفاسير (continuation) |
packed_ids_0013.parquet |
↳ التفاسير (continuation) |
packed_ids_0014.parquet |
↳ التفاسير (continuation) |
packed_ids_0015.parquet |
↳ التفاسير (continuation) |
packed_ids_0016.parquet |
↳ التفاسير (continuation) |
packed_ids_0017.parquet |
↳ التفاسير (continuation) |
packed_ids_0018.parquet |
↳ التفاسير (continuation) |
packed_ids_0019.parquet |
↳ التفاسير (continuation) |
packed_ids_0020.parquet |
↳ التفاسير (continuation) |
packed_ids_0021.parquet |
↳ التفاسير (continuation) |
packed_ids_0022.parquet |
↳ التفاسير (continuation) |
packed_ids_0023.parquet |
↳ التفاسير (continuation) |
packed_ids_0024.parquet |
↳ التفاسير (continuation) |
packed_ids_0025.parquet |
↳ التفاسير (continuation) |
packed_ids_0026.parquet |
التفاسير (Tafsir) |
packed_ids_0027.parquet |
التفاسير (Tafsir) |
packed_ids_0028.parquet |
التفاسير (Tafsir) |
packed_ids_0029.parquet |
↳ التفاسير (continuation) |
packed_ids_0030.parquet |
↳ التفاسير (continuation) |
packed_ids_0031.parquet |
التفاسير (Tafsir) |
packed_ids_0032.parquet |
التفاسير (Tafsir) |
packed_ids_0033.parquet |
↳ التفاسير (continuation) |
packed_ids_0034.parquet |
↳ التفاسير (continuation) |
packed_ids_0035.parquet |
↳ التفاسير (continuation) |
packed_ids_0036.parquet |
متون الحديث (Hadith Texts) |
packed_ids_0037.parquet |
↳ متون الحديث (continuation) |
packed_ids_0038.parquet |
↳ متون الحديث (continuation) |
packed_ids_0039.parquet |
متون الحديث (Hadith Texts) |
packed_ids_0040.parquet |
↳ متون الحديث (continuation) |
packed_ids_0041.parquet |
متون الحديث (Hadith Texts) |
packed_ids_0042.parquet |
متون الحديث (Hadith Texts) |
packed_ids_0043.parquet |
↳ متون الحديث (continuation) |
packed_ids_0044.parquet |
متون الحديث (Hadith Texts) |
packed_ids_0045.parquet |
↳ متون الحديث (continuation) |
packed_ids_0046.parquet |
العقيدة (Aqeedah / Creed) |
Summary by Category
| Category | Files | File Range |
|---|---|---|
| فقه عام (General Fiqh) | 3 | 0000–0002 |
| الفتاوى (Fatwas) | 3 | 0003–0005 |
| كتب ابن القيم (Ibn al-Qayyim) | 1 | 0006 |
| كتب ابن تيمية (Ibn Taymiyyah) | 2 | 0007–0008 |
| النحو والصرف (Grammar) | 2 | 0009–0010 |
| التفاسير (Tafsir) | 22 | 0011–0035 |
| متون الحديث (Hadith) | 10 | 0036–0045 |
| العقيدة (Aqeedah) | 1 | 0046 |
⚠️ Important Notes
Files marked with
↳do not start with a new book header. They are continuations of the previous file's book. A single book can span multiple Parquet files when its token count exceeds 50,000 chunks.The category is NOT stored inside the Parquet file. Each file has only
input_idsandattention_maskcolumns. To determine a chunk's category, you must decode the text and look for the header: الكتاب: المؤلف: التصنيف:
text
Each file has ~50,000 rows (except the last file of each book, which may be smaller).
To extract a specific category, use the file range from the table above.
Example: Extract All Tafsir Chunks
import pandas as pd
# Tafsir is in files 0011 to 0035
tafsir_files = [f"data/packed_ids_{i:04d}.parquet" for i in range(11, 36)]
tafsir_chunks = pd.concat([pd.read_parquet(f) for f in tafsir_files])
print(f"Total Tafsir chunks: {len(tafsir_chunks):,}")
Example: Extract All Hadith Chunks
python
# Hadith is in files 0036 to 0045
hadith_files = [f"data/packed_ids_{i:04d}.parquet" for i in range(36, 46)]
hadith_chunks = pd.concat([pd.read_parquet(f) for f in hadith_files])
print(f"Total Hadith chunks: {len(hadith_chunks):,}")
Example: Generate a Full File-to-Category Map
python
import glob, json, re
import pyarrow.parquet as pq
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained("sherif1313/3arabLM-4B-islamic-v2")
HEADER_RE = re.compile(
r"الكتاب:\s*([^\n]+)\n"
r"المؤلف:\s*([^\n]+)\n"
r"التصنيف:\s*([^\n]+)"
)
mapping = {}
for f in sorted(glob.glob("data/packed_ids_*.parquet")):
pf = pq.ParquetFile(f)
tbl = pf.read_row_group(0, columns=["input_ids", "attention_mask"])
ids = tbl.column("input_ids")[0].as_py()
mask = tbl.column("attention_mask")[0].as_py()
text = tok.decode([i for i, m in zip(ids, mask) if m], skip_special_tokens=True)
m = HEADER_RE.search(text[:1500])
mapping[f.split("/")[-1]] = {
"book": m.group(1).strip() if m else None,
"author": m.group(2).strip() if m else None,
"category": m.group(3).strip() if m else None,
}
with open("file_categories.json", "w", encoding="utf-8") as fp:
json.dump(mapping, fp, ensure_ascii=False, indent=2)
🚀 Usage Load the dataset
from datasets import load_dataset
ds = load_dataset("sherif1313/3arabLM-corpus", split="train")
print(ds)
# Dataset({
# features: ['input_ids', 'attention_mask'],
# num_rows: 2209875
# })
Decode a sample
python
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained(
"sherif1313/3arabLM-4B-islamic-v2",
trust_remote_code=True,
)
sample = ds[0]
ids = sample["input_ids"]
mask = sample["attention_mask"]
# Extract only real tokens (no padding)
real_ids = [i for i, m in zip(ids, mask) if m]
text = tok.decode(real_ids, skip_special_tokens=True)
print(text[:500])
Read a single file directly
import pandas as pd
df = pd.read_parquet("data/packed_ids_0000.parquet")
print(df.head())
# input_ids attention_mask
# 0 [30350, 214854, 25, 174721, ...] [1, 1, 1, ...]
🏗️ File Structure Each Parquet file contains 50,000 rows (except the last one), where each row = 1,024 tokens.
During packing, the following header was prepended to each chunk:
text Book: Author: Category: Part:
[PAGE ]
🎯 Use Cases Training Arabic language models (Pre-training / Continued Pre-training)
Building Arabic RAG systems using FAISS + Arabic embedding models
Semantic search in classical Islamic and Arabic texts
Analyzing Islamic texts (Fiqh, Hadith, Tafsir, Aqeedah)
Metadata-Guided Generation (source-grounded text generation)
🔗 Related Repositories
Repository Description sherif1313/3arabLM-4B-islamic-v2 3arabLM 4B model trained on Shamela sherif1313/3arabLM-RAG Pre-built FAISS index (coming soon) 📄
The original texts are sourced from the Shamela Library Official Library: goldenshamela
Tokenization and structure: Apache 2.0
- Downloads last month
- 74