Files changed (1) hide show
  1. README.md +115 -0
README.md CHANGED
@@ -26,4 +26,119 @@ configs:
26
  data_files:
27
  - split: train
28
  path: data/train-*
 
 
 
 
 
 
 
 
 
 
29
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  data_files:
27
  - split: train
28
  path: data/train-*
29
+ license: other
30
+ task_categories:
31
+ - text-generation
32
+ language:
33
+ - en
34
+ tags:
35
+ - document
36
+ - glam
37
+ - lam
38
+ pretty_name: Britain and UK Handbooks Dataset
39
  ---
40
+
41
+ # Britain and UK Handbooks Dataset
42
+
43
+ ## Dataset Description
44
+
45
+ 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.
46
+
47
+ ### Dataset Summary
48
+
49
+ - **Source**: [National Library of Scotland - Britain and UK Handbooks](https://data.nls.uk/data/digitised-collections/britain-uk-handbooks/)
50
+ - **Time Period**: 1954-2005
51
+ - **Format**: Image-text pairs with OCR output
52
+ - **Processing**: Converted from ALTO XML and JPG images to Hugging Face dataset format
53
+ - **Contents**: Official annual reference books covering UK government policy, economy, social welfare, defence, religion, science, and arts
54
+ - **Size**: 27,915 pages, 13.9 million words
55
+
56
+ ## Dataset Structure
57
+
58
+ ### Data Fields
59
+
60
+ Each record in the dataset contains the following fields:
61
+
62
+ - `document_id` (string): Unique identifier for the handbook document
63
+ - `page_number` (string): Page number within the document
64
+ - `image` (image): Scanned image of the handbook page
65
+ - `text` (string): OCR-extracted text from the page
66
+ - `alto_xml` (string): Raw ALTO XML containing detailed OCR information
67
+ - `has_image` (bool): Whether the page has an associated image file
68
+ - `has_alto` (bool): Whether the page has associated ALTO OCR data
69
+
70
+ ## Usage
71
+
72
+ ### Loading the Dataset
73
+
74
+ ```python
75
+ from datasets import load_dataset
76
+
77
+ # Load the dataset
78
+ dataset = load_dataset("davanstrien/nls-handbooks-test")
79
+
80
+ # Access the data
81
+ for example in dataset['train']:
82
+ print(f"Document: {example['document_id']}")
83
+ print(f"Page: {example['page_number']}")
84
+ print(f"Text preview: {example['text'][:200]}...")
85
+ break
86
+ ```
87
+
88
+ ### Filtering for Complete Records
89
+
90
+ ```python
91
+ # Filter for pages with both images and OCR text
92
+ complete_pages = dataset.filter(lambda x: x['has_image'] and x['has_alto'])
93
+ print(f"Complete pages: {len(complete_pages)}")
94
+ ```
95
+
96
+ ## Dataset Creation
97
+
98
+ ### Source Data
99
+
100
+ 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.
101
+
102
+ ### Processing Pipeline
103
+
104
+ 1. **Original Format**: High-resolution JPG scans and ALTO XML files with OCR output
105
+ 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
106
+
107
+ ## Considerations for Using this Data
108
+
109
+ ### Historical Context
110
+ These handbooks represent official UK government information from 1954 to 2005 and should be understood within their historical and political context.
111
+
112
+ ### OCR Quality
113
+ Text extraction quality varies based on original document condition and print quality.
114
+
115
+ ## Additional Information
116
+
117
+ ### Licensing
118
+
119
+ - **Items up to 1968**: Public domain
120
+ - **Items from 1969 onwards**: Open Government License v.3.0
121
+
122
+ 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.
123
+
124
+ ### Citation
125
+
126
+ ```bibtex
127
+ @misc{nls_uk_handbooks,
128
+ title={Britain and UK Handbooks},
129
+ author={National Library of Scotland},
130
+ howpublished={\url{https://data.nls.uk/data/digitised-collections/britain-uk-handbooks/}},
131
+ }
132
+
133
+ @misc{uk_handbooks_hf,
134
+ title={Britain and UK Handbooks - Hugging Face Dataset},
135
+ author={van Strien, Daniel},
136
+ year={2024},
137
+ publisher={Hugging Face},
138
+ howpublished={\url{https://huggingface.co/datasets/davanstrien/nls-handbooks-test}},
139
+ }
140
+ ```
141
+
142
+ ### Acknowledgments
143
+
144
+ Thanks to the National Library of Scotland for digitising and making these historical reference materials available for research.