---
license: apache-2.0
language:
- ar
tags:
- OCR
- Arabic-OCR
- OCR-Arabic-HTML
configs:
- config_name: default
data_files:
- split: train
path: metadata.csv
---
# Gutenberg Arabic HTML-Page Dataset
## 📖 Dataset Description
The **Gutenberg Arabic HTML-Page Dataset** is a large-scale, synthetically generated dataset designed for training and evaluating document understanding and Optical Character Recognition (OCR) models. The primary goal of this project is to provide a comprehensive resource of page images paired with their corresponding structured HTML ground truth, with a focus on the Arabic language.
The dataset was created by processing classic English literature from the **Project Gutenberg** library. The content was automatically translated into Arabic and then rendered into thousands of unique page images, featuring a wide variety of layouts, fonts, and sizes to ensure model robustness.
This resource is ideal for tasks such as:
* OCR for non-standard Arabic fonts.
* Document layout analysis.
* Training models to understand the semantic structure of a page (e.g., headers, paragraphs).
---
## 🛠️ Dataset Creation
The creation process followed a multi-stage automated pipeline:
### 1. Source Data Acquisition
A selection of popular books was downloaded in HTML format from the Project Gutenberg library. This provided the base text and initial document structure.
### 2. Automated Translation
The raw English HTML content of each book was parsed, and all text nodes were translated into Arabic using the **Google Translate API** (via the `deep-translator` library). This step preserved the original HTML tags while replacing the text content.
### 3. Page Segmentation and Rendering
The translated HTML books were too large to be used as single data points. Therefore, a script using **Playwright** was developed to intelligently segment the content into individual pages. This process works by:
* Virtually rendering the book in a headless browser.
* Measuring the content height as text is added.
* "Cutting" the page once it reaches the maximum height for a given layout.
### 4. Synthetic Data Augmentation
To create a diverse and robust dataset, several augmentation techniques were applied during the rendering phase:
* **Page Layouts:** Pages were rendered using multiple dimensions and aspect ratios.
* A4 (794x1123 px)
* Letter (816x1056 px)
* Small (600x850 px)
* **Typography:** A variety of high-quality, open-source Arabic fonts were used randomly for each page to ensure models do not overfit to a single style.
* **Fonts Used:** Noto Naskh Arabic, Amiri, Tajawal, Cairo, Lateef, IBM Plex Sans Arabic.
* **Font Sizes:** Ranged from 14pt to 24pt.
### 5. Structural Heuristics
A key feature of this dataset is its structured ground truth. Simple heuristics were applied to the HTML of each page to automatically add basic semantic tags, better reflecting a real-world document structure.
* Short, standalone lines at the start of a page were wrapped in `
...
`.
* All page content was enclosed within `...` tags.
---
## 📊 Dataset Statistics
The current version of the dataset consists of **1,316 pages** generated from 16 distinct books.
### Included Books
| Book Title | Gutenberg ID | Page Count |
| --------------------------------------- | ------------ | ---------- |
| Pride and Prejudice | 1342 | 629 |
| The Adventures of Tom Sawyer | 74 | 333 |
| A Tale of Two Cities | 23 & 98 | 70 |
| The Adventures of Huckleberry Finn | 76 | 48 |
| Anne of Green Gables | 45 | 42 |
| The War of the Worlds | 36 | 32 |
| Frankenstein | 84 | 31 |
| The Wonderful Wizard of Oz | 55 | 28 |
| A Christmas Carol | 46 | 20 |
| Peter Pan | 16 | 20 |
| Through the Looking-Glass | 12 | 17 |
| Alice's Adventures in Wonderland | 11 | 15 |
| The Adventures of Sherlock Holmes | 1661 | 15 |
| The Strange Case of Dr. Jekyll and Mr. Hyde | 43 | 13 |
| The Legend of Sleepy Hollow | 41 | 3 |
| **Total** | **-** | **1,316** |
### Exploratory Data Analysis (EDA)
An analysis of the generated HTML files reveals the following distribution of key structural tags:
| Tag | Total Occurrences | Pages with Tag | Percentage of Pages |
| --------- | ----------------- | -------------- | ------------------- |
| `` | 1,316 | 1,316 / 1,316 | 100.00% |
| `` | 1,316 | 1,316 / 1,316 | 100.00% |
| `