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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: Arabic Manuscript Collection
|
| 3 |
+
language:
|
| 4 |
+
- ar
|
| 5 |
+
task_categories:
|
| 6 |
+
- image-to-text
|
| 7 |
+
tags:
|
| 8 |
+
- ocr
|
| 9 |
+
- htr
|
| 10 |
+
- handwriting-recognition
|
| 11 |
+
- arabic
|
| 12 |
+
- manuscripts
|
| 13 |
+
size_categories:
|
| 14 |
+
- 10K<n<100K
|
| 15 |
+
license: other
|
| 16 |
+
license_name: mixed-per-subset
|
| 17 |
+
configs:
|
| 18 |
+
- config_name: Omar-al-Saleh
|
| 19 |
+
data_files:
|
| 20 |
+
- split: train
|
| 21 |
+
path: Omar-al-Saleh/train.csv
|
| 22 |
+
- split: validation
|
| 23 |
+
path: Omar-al-Saleh/val.csv
|
| 24 |
+
- split: test
|
| 25 |
+
path: Omar-al-Saleh/test.csv
|
| 26 |
+
- config_name: Muharaf
|
| 27 |
+
data_files:
|
| 28 |
+
- split: train
|
| 29 |
+
path: Muharaf/train.csv
|
| 30 |
+
- split: validation
|
| 31 |
+
path: Muharaf/val.csv
|
| 32 |
+
- split: test
|
| 33 |
+
path: Muharaf/test.csv
|
| 34 |
+
- config_name: AraMs-28k-HTR
|
| 35 |
+
data_files:
|
| 36 |
+
- split: train
|
| 37 |
+
path: AraMs-28k-HTR/train.csv
|
| 38 |
+
- split: validation
|
| 39 |
+
path: AraMs-28k-HTR/val.csv
|
| 40 |
+
- split: test
|
| 41 |
+
path: AraMs-28k-HTR/test.csv
|
| 42 |
+
- config_name: AHDQ
|
| 43 |
+
data_files:
|
| 44 |
+
- split: train
|
| 45 |
+
path: AHDQ/train.csv
|
| 46 |
+
- split: validation
|
| 47 |
+
path: AHDQ/val.csv
|
| 48 |
+
- split: test
|
| 49 |
+
path: AHDQ/test.csv
|
| 50 |
+
- config_name: KHATT
|
| 51 |
+
data_files:
|
| 52 |
+
- split: train
|
| 53 |
+
path: KHATT/train.csv
|
| 54 |
+
- split: validation
|
| 55 |
+
path: KHATT/val.csv
|
| 56 |
+
- split: test
|
| 57 |
+
path: KHATT/test.csv
|
| 58 |
+
---
|
| 59 |
+
|
| 60 |
+
# Arabic Manuscript Collection
|
| 61 |
+
|
| 62 |
+
Five Arabic handwritten text recognition (HTR) datasets, converted to **one layout**
|
| 63 |
+
and **one label format** so they can be trained and evaluated together:
|
| 64 |
+
**82,561 labelled images** in total.
|
| 65 |
+
|
| 66 |
+
Four of the sources are historical manuscripts. KHATT is modern handwriting and is
|
| 67 |
+
included as a separate, optional subset.
|
| 68 |
+
|
| 69 |
+
Curated by **TheSeniorTeam**, a PSU senior project supervised by Prof. Samer Samarah.
|
| 70 |
+
We fine-tune an open vision-language model on historical Arabic handwriting and evaluate
|
| 71 |
+
it with CER/WER on held-out manuscripts. This repository is that project's data module.
|
| 72 |
+
|
| 73 |
+
## Subsets
|
| 74 |
+
|
| 75 |
+
| Subset | Train | Val | Test | Total | Unit | Content | Diacritised lines | License |
|
| 76 |
+
|---|---:|---:|---:|---:|---|---|---:|---|
|
| 77 |
+
| **Omar-al-Saleh** | 15,164 | 798 | 2,095 | 18,057 | line | Handwritten memoirs, 1951–1965, 16 documents | ~3% | CC BY 4.0 |
|
| 78 |
+
| **Muharaf** | 22,092 | 1,069 | 1,334 | 24,495 | line | Historic letters, journals, poetry, church and legal records | ~35% | CC BY-NC-SA 4.0 |
|
| 79 |
+
| **AraMs-28k-HTR** | 19,739 | 1,486 | 6,744 | 27,969 | line | 14 books: 13 manuscripts in Naskh, Ruq'ah and Maghrebi scripts, plus 1 lithographed edition | 0% | CC BY-NC-SA 4.0 |
|
| 80 |
+
| **AHDQ** | 579 | 31 | 32 | 642 | **page** | Binarized handwritten Quran pages, 6 handwriting styles | 100% | MIT |
|
| 81 |
+
| *KHATT* | *8,094* | *1,901* | *1,403* | *11,398* | *line* | *Modern unconstrained handwriting, 838 writers* | *0%* | *Research use (see below)* |
|
| 82 |
+
|
| 83 |
+
Every CSV row has a matching image file, and the train, validation and test splits share no images.
|
| 84 |
+
|
| 85 |
+
**AHDQ is page-level.** Each image is a full page with a median of about 940 characters of
|
| 86 |
+
text, up to 3,600. Every other subset uses line crops with a median of 47–70 characters.
|
| 87 |
+
Batch AHDQ separately, or filter it out if your model has a short context.
|
| 88 |
+
|
| 89 |
+
## Layout
|
| 90 |
+
|
| 91 |
+
```
|
| 92 |
+
<Subset>/
|
| 93 |
+
images.zip # contains images/train/, images/val/, images/test/
|
| 94 |
+
train.csv # image_path,text
|
| 95 |
+
val.csv
|
| 96 |
+
test.csv
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
- `image_path` is a bare filename inside `images/<split>/`. The CSV's name already
|
| 100 |
+
says which split it belongs to.
|
| 101 |
+
- `text` is the ground-truth transcription in Unicode Arabic, not normalized. Diacritics
|
| 102 |
+
(tashkeel), punctuation and digits are kept exactly as the source provides them.
|
| 103 |
+
- Images are PNG, except KHATT, which uses JPG.
|
| 104 |
+
|
| 105 |
+
Extra files:
|
| 106 |
+
|
| 107 |
+
| File | What it is |
|
| 108 |
+
|---|---|
|
| 109 |
+
| `AraMs-28k-HTR/metadata.csv` | Per-line provenance: `book_id`, `page_id`, `line_idx`, `line_type`, `split`. The `img_path` column predates the reorganisation, so join to the split CSVs on the filename. |
|
| 110 |
+
| `AraMs-28k-HTR/split_used.json` | Which books are in which split. |
|
| 111 |
+
| `AraMs-28k-HTR/dataset_stats.json` | Line, page and book counts per split and per book. |
|
| 112 |
+
| `AHDQ/labels.csv` | The original unsplit label file for all 642 pages (`file_name,text`). |
|
| 113 |
+
| `KHATT/khatt-label-decoder.ipynb` | Decodes KHATT's Latin transliteration codes into Arabic (see below). |
|
| 114 |
+
|
| 115 |
+
## Usage
|
| 116 |
+
|
| 117 |
+
**Text only**, for example to inspect labels or build a vocabulary:
|
| 118 |
+
|
| 119 |
+
```python
|
| 120 |
+
from datasets import load_dataset
|
| 121 |
+
ds = load_dataset("TheSeniorTeam/Arabic_Manuscript_Collection_Dataset", "Muharaf")
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
**With images:**
|
| 125 |
+
|
| 126 |
+
```python
|
| 127 |
+
import zipfile
|
| 128 |
+
import pandas as pd
|
| 129 |
+
from huggingface_hub import hf_hub_download
|
| 130 |
+
|
| 131 |
+
repo, subset, split = "TheSeniorTeam/Arabic_Manuscript_Collection_Dataset", "Muharaf", "train"
|
| 132 |
+
|
| 133 |
+
zipfile.ZipFile(hf_hub_download(repo, f"{subset}/images.zip", repo_type="dataset")).extractall(subset)
|
| 134 |
+
df = pd.read_csv(hf_hub_download(repo, f"{subset}/{split}.csv", repo_type="dataset"))
|
| 135 |
+
df["image"] = f"{subset}/images/{split}/" + df["image_path"]
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
**Whole repo** (about 4.4 GB):
|
| 139 |
+
|
| 140 |
+
```bash
|
| 141 |
+
hf download TheSeniorTeam/Arabic_Manuscript_Collection_Dataset --repo-type dataset --local-dir .
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
## Splits: which are official and which we made
|
| 145 |
+
|
| 146 |
+
**Do not re-split these subsets by line.** A line-level split puts the same writer or
|
| 147 |
+
book in both train and test, so test scores measure memorisation instead of
|
| 148 |
+
generalisation.
|
| 149 |
+
|
| 150 |
+
| Subset | Train / test | Validation |
|
| 151 |
+
|---|---|---|
|
| 152 |
+
| Omar-al-Saleh | Official | **Ours.** 5% of official train, seed 0 |
|
| 153 |
+
| Muharaf | Official | Official |
|
| 154 |
+
| AraMs-28k-HTR | Official and **split by book**: 9 train, 2 val, 3 test books | Official |
|
| 155 |
+
| AHDQ | **Ours.** No upstream split. 90/5/5, stratified by style so all six styles appear in every split | Ours |
|
| 156 |
+
| KHATT | Train official. **Test is ours:** 104 of 691 train writers held out, seed 3, split by writer | Official, writer-disjoint from train |
|
| 157 |
+
|
| 158 |
+
- **Omar-al-Saleh:** The 2,671-line **blind test** set from the NAKBA NLP 2026 shared task
|
| 159 |
+
is **deliberately not included**, so it can't end up in training by accident.
|
| 160 |
+
Upstream train has 15,969 rows. This copy has 15,962; the 7-row gap comes from upstream.
|
| 161 |
+
- **AHDQ:** The style is encoded in the filename prefix: `dmn_`, `sdc_`, `sas_`, `sal_`,
|
| 162 |
+
`sbi_`, `sfm_`.
|
| 163 |
+
- **KHATT:** `KHATT_v1.0` ships a test split but exposes no writer ID, so there is no way to
|
| 164 |
+
check that it shares no writers with this train set. We held out our own test set instead.
|
| 165 |
+
|
| 166 |
+
## KHATT is optional
|
| 167 |
+
|
| 168 |
+
KHATT is modern handwriting (1,000 writers originally, 838 in this copy), not manuscripts.
|
| 169 |
+
It is here for pre-training or comparison. Leave it out if you are measuring manuscript HTR.
|
| 170 |
+
|
| 171 |
+
The upstream CSVs label each line as Latin transliteration codes, one per column
|
| 172 |
+
(`ke la sp ah na …`). We decoded them into Arabic with the Arabic-Latin lookup table in
|
| 173 |
+
the KHATT v1.0 readme, plus 4 lam-alef ligature codes the table leaves out. All 67 codes
|
| 174 |
+
resolve, covering 100% of tokens in both upstream CSVs, so no character was guessed.
|
| 175 |
+
`khatt-label-decoder.ipynb` reproduces the decoding. Upstream CSVs name images `.tif`,
|
| 176 |
+
but the files are `.jpg`; this copy uses the real filenames.
|
| 177 |
+
|
| 178 |
+
## Known limitations
|
| 179 |
+
|
| 180 |
+
- **No `source` or `document_id` column yet.** Document grouping is only partly available:
|
| 181 |
+
AraMs has `book_id` in `metadata.csv`, AHDQ has the style prefix, and Muharaf and this
|
| 182 |
+
Omar copy expose none. Until an ID column exists, you can't safely create a new split.
|
| 183 |
+
- **Diacritics vary by subset**, from 0% (AraMs, KHATT) to 100% (AHDQ). A model trained on
|
| 184 |
+
a mix has to learn when tashkeel is expected. Report CER both with and without
|
| 185 |
+
diacritics.
|
| 186 |
+
- A handful of Muharaf and Omar transcriptions contain a newline inside the text field,
|
| 187 |
+
and one Muharaf train row has empty text. Use a real CSV parser, not line splitting.
|
| 188 |
+
- Omar-al-Saleh has a single writer, so good test scores there say little about other hands.
|
| 189 |
+
|
| 190 |
+
## Licensing
|
| 191 |
+
|
| 192 |
+
There is **no single license.** Each subset keeps its upstream terms, and using the
|
| 193 |
+
collection as a whole means following all of them. The two CC BY-NC-SA subsets make any
|
| 194 |
+
combined use **non-commercial**.
|
| 195 |
+
|
| 196 |
+
| Subset | License | Upstream |
|
| 197 |
+
|---|---|---|
|
| 198 |
+
| Omar-al-Saleh | CC BY 4.0 | [`U4RASD/omar-al-saleh-manuscripts-segments`](https://huggingface.co/datasets/U4RASD/omar-al-saleh-manuscripts-segments) (Doha Institute) |
|
| 199 |
+
| Muharaf | CC BY-NC-SA 4.0 | [`aamijar/muharaf-public`](https://huggingface.co/datasets/aamijar/muharaf-public) |
|
| 200 |
+
| AraMs-28k-HTR | CC BY-NC-SA 4.0 | [Zenodo 10.5281/zenodo.22095333](https://doi.org/10.5281/zenodo.22095333) |
|
| 201 |
+
| AHDQ | MIT | [Kaggle](https://www.kaggle.com/datasets/abdoukhadrembacke/ahdq-arabic-handwriting-dataset-from-quran) |
|
| 202 |
+
| KHATT | Free for research, distributed by KFUPM. Check their terms before redistributing. | [KHATT, KFUPM](https://doi.org/10.1016/j.patcog.2013.08.009) |
|
| 203 |
+
|
| 204 |
+
## Citation
|
| 205 |
+
|
| 206 |
+
If you use a subset, cite its original authors:
|
| 207 |
+
|
| 208 |
+
```bibtex
|
| 209 |
+
@misc{saeed2024muharaf,
|
| 210 |
+
title = {Muharaf: Manuscripts of Handwritten Arabic Dataset for Cursive Text Recognition},
|
| 211 |
+
author = {Saeed, Mehreen and Chan, Adrian and Mijar, Anupam and Moukarzel, Joseph and Habchi, Georges and Younes, Carlos and Elias, Amin and Wong, Chau-Wai and Khater, Akram},
|
| 212 |
+
year = {2024},
|
| 213 |
+
eprint = {2406.09630},
|
| 214 |
+
archivePrefix = {arXiv},
|
| 215 |
+
note = {NeurIPS 2024}
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
@misc{guechaoui2026arams28k,
|
| 219 |
+
title = {AraMS-28k: The Largest Publicly Released Line-Level Dataset of Historical Arabic Manuscripts with Margin and Insertion-Anchor Annotations},
|
| 220 |
+
author = {Guechaoui, Mohamed and Zellagui, Mohamed Diaa and Chaib, Souleyman and Dhelim, Sahraoui},
|
| 221 |
+
year = {2026},
|
| 222 |
+
eprint = {2608.26921},
|
| 223 |
+
archivePrefix = {arXiv}
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
@article{mahmoud2014khatt,
|
| 227 |
+
title = {KHATT: An Open Arabic Offline Handwritten Text Database},
|
| 228 |
+
author = {Mahmoud, Sabri A. and Ahmad, Irfan and Al-Khatib, Wasfi G. and Alshayeb, Mohammad and Parvez, Mohammad Tanvir and M{\"a}rgner, Volker and Fink, Gernot A.},
|
| 229 |
+
journal = {Pattern Recognition},
|
| 230 |
+
volume = {47},
|
| 231 |
+
number = {3},
|
| 232 |
+
pages = {1096--1112},
|
| 233 |
+
year = {2014},
|
| 234 |
+
doi = {10.1016/j.patcog.2013.08.009}
|
| 235 |
+
}
|
| 236 |
+
```
|
| 237 |
+
|
| 238 |
+
- **Omar-al-Saleh:** *NAKBA NLP 2026: Shared Task on Arabic Handwritten Manuscript
|
| 239 |
+
Understanding*, 2nd International Workshop, co-located with LREC 2026, Palma, Mallorca.
|
| 240 |
+
- **AHDQ:** XIDMA_AI (2024). *AHDQ (Arabic Handwriting Dataset from Quran)*. Kaggle.
|