File size: 4,524 Bytes
e56b510
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e9d7dba
 
 
 
 
 
 
 
 
 
e56b510
e9d7dba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
dataset_info:
  features:
  - name: document_id
    dtype: string
  - name: page_number
    dtype: string
  - name: image
    dtype: image
  - name: text
    dtype: string
  - name: alto_xml
    dtype: string
  - name: has_image
    dtype: bool
  - name: has_alto
    dtype: bool
  splits:
  - name: train
    num_bytes: 6287148075.79
    num_examples: 27915
  download_size: 4577357644
  dataset_size: 6287148075.79
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
license: other
task_categories:
- text-generation
language:
- en
tags:
- document
- glam
- lam
pretty_name: Britain and UK Handbooks Dataset
---

# Britain and UK Handbooks Dataset

## Dataset Description

This dataset contains digitised Britain and UK Handbooks from the National Library of Scotland's digital collections. These annual reference books were originally published by the British Information Service (starting in 1946) to provide overseas readers with comprehensive information about the United Kingdom.

### Dataset Summary

- **Source**: [National Library of Scotland - Britain and UK Handbooks](https://data.nls.uk/data/digitised-collections/britain-uk-handbooks/)
- **Time Period**: 1954-2005
- **Format**: Image-text pairs with OCR output
- **Processing**: Converted from ALTO XML and JPG images to Hugging Face dataset format
- **Contents**: Official annual reference books covering UK government policy, economy, social welfare, defence, religion, science, and arts
- **Size**: 27,915 pages, 13.9 million words

## Dataset Structure

### Data Fields

Each record in the dataset contains the following fields:

- `document_id` (string): Unique identifier for the handbook document
- `page_number` (string): Page number within the document
- `image` (image): Scanned image of the handbook page
- `text` (string): OCR-extracted text from the page
- `alto_xml` (string): Raw ALTO XML containing detailed OCR information
- `has_image` (bool): Whether the page has an associated image file
- `has_alto` (bool): Whether the page has associated ALTO OCR data

## Usage

### Loading the Dataset

```python
from datasets import load_dataset

# Load the dataset
dataset = load_dataset("davanstrien/nls-handbooks-test")

# Access the data
for example in dataset['train']:
    print(f"Document: {example['document_id']}")
    print(f"Page: {example['page_number']}")
    print(f"Text preview: {example['text'][:200]}...")
    break
```

### Filtering for Complete Records

```python
# Filter for pages with both images and OCR text
complete_pages = dataset.filter(lambda x: x['has_image'] and x['has_alto'])
print(f"Complete pages: {len(complete_pages)}")
```

## Dataset Creation

### Source Data

The original data comes from the National Library of Scotland's digitisation of Britain and UK Handbooks - annual reference publications that provided factual overviews of the UK, including government policy, national economy, social welfare, defence, religion, science, and arts.

### Processing Pipeline

1. **Original Format**: High-resolution JPG scans and ALTO XML files with OCR output
2. **Conversion Process**: Using the `convert_to_hf_dataset.py` script to pair images with corresponding ALTO XML and extract plain text while preserving metadata

## Considerations for Using this Data

### Historical Context
These handbooks represent official UK government information from 1954 to 2005 and should be understood within their historical and political context.

### OCR Quality
Text extraction quality varies based on original document condition and print quality.

## Additional Information

### Licensing

- **Items up to 1968**: Public domain
- **Items from 1969 onwards**: Open Government License v.3.0

Please refer to the [National Library of Scotland's terms of use](https://data.nls.uk/data/digitised-collections/britain-uk-handbooks/) for complete licensing information.

### Citation

```bibtex
@misc{nls_uk_handbooks,
  title={Britain and UK Handbooks},
  author={National Library of Scotland},
  howpublished={\url{https://data.nls.uk/data/digitised-collections/britain-uk-handbooks/}},
}

@misc{uk_handbooks_hf,
  title={Britain and UK Handbooks - Hugging Face Dataset},
  author={van Strien, Daniel},
  year={2024},
  publisher={Hugging Face},
  howpublished={\url{https://huggingface.co/datasets/davanstrien/nls-handbooks-test}},
}
```

### Acknowledgments

Thanks to the National Library of Scotland for digitising and making these historical reference materials available for research.