Datasets:
Commit
·
09ed0f8
verified
·
0
Parent(s):
Squashing commit
Browse files- .gitattributes +59 -0
- README.md +209 -0
- data/train-00000-of-00004.parquet +3 -0
- data/train-00001-of-00004.parquet +3 -0
- data/train-00002-of-00004.parquet +3 -0
- data/train-00003-of-00004.parquet +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.lz4 filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.mds filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
# Audio files - uncompressed
|
| 39 |
+
*.pcm filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
*.sam filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
*.raw filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
# Audio files - compressed
|
| 43 |
+
*.aac filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
*.flac filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
*.ogg filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
*.wav filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
# Image files - uncompressed
|
| 49 |
+
*.bmp filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
*.tiff filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
# Image files - compressed
|
| 54 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
# Video files - compressed
|
| 58 |
+
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
*.webm filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
dataset_info:
|
| 3 |
+
features:
|
| 4 |
+
- name: document_id
|
| 5 |
+
dtype: string
|
| 6 |
+
- name: page_number
|
| 7 |
+
dtype: int32
|
| 8 |
+
- name: file_identifier
|
| 9 |
+
dtype: string
|
| 10 |
+
- name: image
|
| 11 |
+
dtype: image
|
| 12 |
+
- name: text
|
| 13 |
+
dtype: string
|
| 14 |
+
- name: alto_xml
|
| 15 |
+
dtype: string
|
| 16 |
+
- name: has_image
|
| 17 |
+
dtype: bool
|
| 18 |
+
- name: has_alto
|
| 19 |
+
dtype: bool
|
| 20 |
+
- name: document_metadata
|
| 21 |
+
dtype: string
|
| 22 |
+
- name: has_metadata
|
| 23 |
+
dtype: bool
|
| 24 |
+
- name: exam_type
|
| 25 |
+
dtype: string
|
| 26 |
+
- name: exam_year
|
| 27 |
+
dtype: string
|
| 28 |
+
- name: exam_reference
|
| 29 |
+
dtype: string
|
| 30 |
+
splits:
|
| 31 |
+
- name: train
|
| 32 |
+
num_bytes: 1646707701.999
|
| 33 |
+
num_examples: 11141
|
| 34 |
+
download_size: 1403366547
|
| 35 |
+
dataset_size: 1646707701.999
|
| 36 |
+
configs:
|
| 37 |
+
- config_name: default
|
| 38 |
+
data_files:
|
| 39 |
+
- split: train
|
| 40 |
+
path: data/train-*
|
| 41 |
+
license: cc0-1.0
|
| 42 |
+
task_categories:
|
| 43 |
+
- text-generation
|
| 44 |
+
language:
|
| 45 |
+
- en
|
| 46 |
+
tags:
|
| 47 |
+
- ocr
|
| 48 |
+
---
|
| 49 |
+
|
| 50 |
+
# Scottish School Exam Papers Dataset
|
| 51 |
+
|
| 52 |
+
## Dataset Description
|
| 53 |
+
|
| 54 |
+
This dataset contains digitised Scottish school examination papers from the National Library of Scotland's (NLS) digital collections. The papers represent historical educational assessment materials that have been processed with Optical Character Recognition (OCR) to extract text content alongside the original page images.
|
| 55 |
+
|
| 56 |
+
### Dataset Summary
|
| 57 |
+
|
| 58 |
+
- **Source**: [National Library of Scotland - Scottish School Exam Papers](https://data.nls.uk/data/digitised-collections/scottish-exams/)
|
| 59 |
+
- **Format**: Image-text pairs with OCR output
|
| 60 |
+
- **Processing**: Converted from ALTO XML and JPG images to Hugging Face dataset format
|
| 61 |
+
- **Contents**: Historical Scottish school examination papers with both scanned images and extracted text
|
| 62 |
+
|
| 63 |
+
## Dataset Structure
|
| 64 |
+
|
| 65 |
+
### Data Fields
|
| 66 |
+
|
| 67 |
+
Each record in the dataset contains the following fields:
|
| 68 |
+
|
| 69 |
+
- `document_id` (string): Unique identifier for the exam paper document
|
| 70 |
+
- `page_number` (string): Page number within the document
|
| 71 |
+
- `image` (image): Scanned image of the exam paper page
|
| 72 |
+
- `text` (string): OCR-extracted text from the page
|
| 73 |
+
- `alto_xml` (string): Raw ALTO XML containing detailed OCR information
|
| 74 |
+
- `has_image` (bool): Whether the page has an associated image file
|
| 75 |
+
- `has_alto` (bool): Whether the page has associated ALTO OCR data
|
| 76 |
+
- `document_metadata` (string): Additional metadata about the document (if available)
|
| 77 |
+
- `has_metadata` (bool): Whether metadata is available for this document
|
| 78 |
+
|
| 79 |
+
### Data Statistics
|
| 80 |
+
|
| 81 |
+
The dataset includes examination papers with varying levels of OCR quality and completeness. Some pages may have images without corresponding OCR text, typically due to:
|
| 82 |
+
- Poor scan quality
|
| 83 |
+
- Handwritten content
|
| 84 |
+
- Complex layouts or mathematical notation
|
| 85 |
+
- Degraded original documents
|
| 86 |
+
|
| 87 |
+
## Usage
|
| 88 |
+
|
| 89 |
+
### Loading the Dataset
|
| 90 |
+
|
| 91 |
+
```python
|
| 92 |
+
from datasets import load_dataset
|
| 93 |
+
|
| 94 |
+
# Load the dataset
|
| 95 |
+
dataset = load_dataset("davanstrien/Scottish-School-Exam-Papers")
|
| 96 |
+
|
| 97 |
+
# Access the data
|
| 98 |
+
for example in dataset['train']:
|
| 99 |
+
print(f"Document: {example['document_id']}")
|
| 100 |
+
print(f"Page: {example['page_number']}")
|
| 101 |
+
print(f"Text preview: {example['text'][:200]}...")
|
| 102 |
+
# Display image if needed
|
| 103 |
+
example['image'].show()
|
| 104 |
+
break
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
### Filtering for Complete Records
|
| 108 |
+
|
| 109 |
+
To work only with pages that have both images and OCR text:
|
| 110 |
+
|
| 111 |
+
```python
|
| 112 |
+
# Filter for complete records
|
| 113 |
+
complete_pages = dataset.filter(lambda x: x['has_image'] and x['has_alto'])
|
| 114 |
+
print(f"Complete pages: {len(complete_pages)}")
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
### Working with ALTO XML
|
| 118 |
+
|
| 119 |
+
The ALTO XML contains detailed OCR information including:
|
| 120 |
+
- Text positioning and layout
|
| 121 |
+
- Confidence scores
|
| 122 |
+
- Character-level bounding boxes
|
| 123 |
+
|
| 124 |
+
```python
|
| 125 |
+
import xml.etree.ElementTree as ET
|
| 126 |
+
|
| 127 |
+
# Parse ALTO XML for detailed OCR information
|
| 128 |
+
def parse_alto_details(alto_xml):
|
| 129 |
+
root = ET.fromstring(alto_xml)
|
| 130 |
+
ns = {'alto': 'http://www.loc.gov/standards/alto/v3/alto.xsd'}
|
| 131 |
+
|
| 132 |
+
# Extract text lines with positioning
|
| 133 |
+
for textline in root.findall('.//alto:TextLine', ns):
|
| 134 |
+
line_text = []
|
| 135 |
+
for string_elem in textline.findall('./alto:String', ns):
|
| 136 |
+
content = string_elem.get('CONTENT', '')
|
| 137 |
+
if content:
|
| 138 |
+
line_text.append(content)
|
| 139 |
+
if line_text:
|
| 140 |
+
print(' '.join(line_text))
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
## Dataset Creation
|
| 144 |
+
|
| 145 |
+
### Source Data
|
| 146 |
+
|
| 147 |
+
The original data comes from the National Library of Scotland's digitization efforts to preserve historical Scottish educational materials. The exam papers represent various subjects, years, and educational levels from Scotland's educational history.
|
| 148 |
+
|
| 149 |
+
### Processing Pipeline
|
| 150 |
+
|
| 151 |
+
1. **Original Format**: The source data consists of:
|
| 152 |
+
- High-resolution JPG scans of exam papers
|
| 153 |
+
- ALTO XML files containing OCR output
|
| 154 |
+
- METS metadata files
|
| 155 |
+
|
| 156 |
+
2. **Conversion Process**: Using the custom conversion script:
|
| 157 |
+
- Paired image files with their corresponding ALTO XML
|
| 158 |
+
- Extracted plain text from ALTO XML while preserving line breaks
|
| 159 |
+
- Maintained document structure and page ordering
|
| 160 |
+
- Preserved metadata associations where available
|
| 161 |
+
|
| 162 |
+
## Considerations for Using this Data
|
| 163 |
+
|
| 164 |
+
### Historical Context
|
| 165 |
+
These examination papers represent historical educational practices and may contain:
|
| 166 |
+
- Outdated terminology or perspectives
|
| 167 |
+
- Historical biases in educational content
|
| 168 |
+
- References to historical events and contexts
|
| 169 |
+
|
| 170 |
+
### OCR Quality
|
| 171 |
+
The quality of text extraction varies based on:
|
| 172 |
+
- Original document condition
|
| 173 |
+
- Print quality and typography
|
| 174 |
+
- Presence of handwritten annotations
|
| 175 |
+
- Mathematical or scientific notation
|
| 176 |
+
|
| 177 |
+
### Recommended Use Cases
|
| 178 |
+
- Historical education research
|
| 179 |
+
- OCR system evaluation and improvement
|
| 180 |
+
- Educational content analysis
|
| 181 |
+
- Digital humanities research
|
| 182 |
+
- Training data for historical document processing
|
| 183 |
+
|
| 184 |
+
## Additional Information
|
| 185 |
+
|
| 186 |
+
### Licensing
|
| 187 |
+
Please refer to the [National Library of Scotland's terms of use](https://data.nls.uk/data/digitised-collections/scottish-exams/) for the original data. Users should comply with NLS's licensing terms when using this dataset.
|
| 188 |
+
|
| 189 |
+
### Citation
|
| 190 |
+
If you use this dataset, please cite both the original source and this Hugging Face dataset:
|
| 191 |
+
|
| 192 |
+
```bibtex
|
| 193 |
+
@misc{nls_scottish_exams,
|
| 194 |
+
title={Scottish School Exam Papers},
|
| 195 |
+
author={National Library of Scotland},
|
| 196 |
+
howpublished={\url{https://data.nls.uk/data/digitised-collections/scottish-exams/}},
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
@misc{scottish_exams_hf,
|
| 200 |
+
title={Scottish School Exam Papers - Hugging Face Dataset},
|
| 201 |
+
author={van Strien, Daniel},
|
| 202 |
+
year={2024},
|
| 203 |
+
publisher={Hugging Face},
|
| 204 |
+
howpublished={\url{https://huggingface.co/datasets/davanstrien/Scottish-School-Exam-Papers}},
|
| 205 |
+
}
|
| 206 |
+
```
|
| 207 |
+
|
| 208 |
+
### Acknowledgments
|
| 209 |
+
Dataset converted to Hugging Face format by [davanstrien](https://huggingface.co/davanstrien)
|
data/train-00000-of-00004.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:778083d11a29fed9fd702be7f0cfbababac5f2d80d912375d6973f3e30cf95ee
|
| 3 |
+
size 324515729
|
data/train-00001-of-00004.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0d91afba9d4f8bc64e35d28ecf097aed0bac1d4c9d117f0fb7b08427efe69707
|
| 3 |
+
size 376902182
|
data/train-00002-of-00004.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:01522d14bd9963b17d7b1b667efbd312fa72b1030d036a3116003e20324727ca
|
| 3 |
+
size 333495540
|
data/train-00003-of-00004.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3a448c2e199ff36f786a1bc2742c89cd43f35ada06715ae5eabbe6347abf4354
|
| 3 |
+
size 368453096
|