On this page
Searching historical newspapers with the Queering Glamorgan glossary
In 2018, Glamorgan Archives published Queering Glamorgan: A Research Guide to Sources for the Study of LGBT History, compiled by Norena Shopland and Dr Daryl Leeworthy. The guide focuses on the former county of Glamorgan and brings together archival sources, case studies and a glossary of historical terminology that can be used when searching for material relating to LGBT history.
It also describes a problem that applies much more widely to historical collections: the language used in the past does not necessarily match the language a researcher would use today.
“Since modern terminology cannot easily be used to understand this aspect of the past”
That sentence was the starting point for this project.
I have previously used Welsh Newspapers Online for data visualisation and large-scale text analysis. After reading Queering Glamorgan, I wanted to see what would happen if its glossary was treated not only as a research guide, but as a structured search vocabulary that could be applied programmatically across a large newspaper corpus.
From a glossary to 92,371 newspaper articles
The glossary is useful for computational searching because it does more than list modern labels. It records historical words and phrases, variant forms and combinations of terms that researchers may encounter in archival and newspaper sources.
Digitised newspapers introduce another problem: OCR. Damaged pages, faded print, unusual typography and original spelling can all affect whether a word is recognised correctly. The guide's advice is therefore practical as well as historical:
“it is advisable to try a variety of terms”
I converted the glossary into a machine-readable vocabulary and used it to query the Solr search index behind Welsh Newspapers Online. Where appropriate, the queries included spelling variants and plausible OCR errors.
The resulting corpus covers 1804–1919 and contains approximately 187 million words. The searches retrieved 92,371 unique newspaper articles. Because one article could match more than one glossary term, these represented 95,087 article–term pairs.
Retrieval was only the first step. Many matches were unrelated uses of the search words. Others included cross-dressing language but were reports or advertisements for pantomimes and other performances.
Using a local language model to make the corpus manageable
Reading and classifying more than 92,000 articles by hand was not practical, so I used Qwen3:8B (qwen3:8b) for two stages of the workflow.
First, the model reviewed each article–term pair and assessed whether the article was relevant to the matched term in context. Secondly, it converted the retained OCR text into structured records containing people, places, case information, dates, outcomes and other fields used by the visualisations.
I ran two instances of Qwen3:8B in parallel on my laptop. Processing the corpus took around four days.
The model did not validate 98 Welsh-language articles reliably, so I processed those manually. Structured extraction was completed for 3,183 of the 3,185 retained articles: 3,085 through the main Qwen workflow and 98 manually.
A later pass revisited the machine-processed articles and added 4,631 field values that had been missed or left empty during the initial extraction. Further implementation detail is included in the methodology at the end of the post.
I checked the place names manually using Nominatim and OpenStreetMap. Of 1,903 distinct entries, 1,223 were linked to a location, 354 were dismissed and 326 remain to be reviewed.
Results
Unless stated otherwise, the charts count unique articles retained after validation. Classifications were produced by Qwen and have not been checked article by article. Gender describes how a person is represented in the newspaper text.
Article types
People in the articles
The database contains 1,749 defendant records across 1805–1919. The decade chart shows 1,736 because it begins with the 1830s: the 13 earlier defendants fall in decades too sparse to plot meaningfully.
Articles over time
The number rises sharply in the later nineteenth century. Some of that pattern reflects how much digitised newspaper material is available from each decade.
Newspapers
The retained articles come from 98 newspaper titles, but they are not distributed evenly between them. The Evening Express, published in Cardiff, contributes 1,232 articles—38.7% of the corpus, or nearly two-fifths.
Evening ExpressA daily English language newspaper, supportive of conservative politics and which circulated in the district of Cardiff. The newspaper's main content included local and general news. Associated titles: Evening Express and Evening Mail (1902-1917).
Search terms
Precise phrases tended to produce a higher proportion of useful material. Short or common words produced far more false positives.
Individual cases
Large news stories can dominate a time series. Looking at individual cases helps explain peaks that would otherwise appear to be changes across the whole dataset.
Oscar Wilde and Boulton and Park are included because their cases were reported widely outside Wales.
Mapping the reports
The place-review totals use a different unit from the map. The extraction produced 1,903 distinct place-name entries across 1,836 articles. I manually reviewed 1,577 entries, geolocating 1,223 and dismissing 354, with 326 still pending. Those linked names resolve to 997 real places. A place name can occur in many articles, while one article can mention several places; the map therefore reports article coverage rather than the number of names reviewed.
The full searched corpus begins in 1804, but the earliest article with a linked map location dates from 1805. The map therefore covers 1805–1919.
Methodology
Source vocabulary and retrieval
The search vocabulary was derived from the glossary in Norena Shopland and Dr Daryl Leeworthy's Queering Glamorgan. The glossary supplied the historical terminology used throughout the searches.
The glossary was converted into a structured search lexicon and queried against the Solr index behind Welsh Newspapers Online. Searches included appropriate spelling variants and plausible OCR variants. Retrieval produced 92,371 unique articles, 95,087 article–term pairs and approximately 187 million words across 1804–1919.
Validation and structured extraction
Each article–term pair was assessed against the context of the matched glossary term. The retained set contains 3,478 relevant pairs across 3,185 unique articles.
Qwen then converted the retained OCR text into structured fields. Extraction succeeded for 3,183 articles. The 98 Welsh-language articles that the model did not validate reliably were processed manually; one further article remained pending and one was abandoned after repeated extraction failure.
The model-generated fields should be treated according to their type. Names, dates and explicit occupations are extracted from the text, although OCR can still affect them.
Evaluating the pipeline
Some newspaper records contained a complete page rather than a single article. This meant the model could extract people and offences from neighbouring stories. I split the pages at their newspaper headings before processing them, reducing 37.8 million characters to 3 million without losing any matched search terms.
The 98 Welsh-language articles followed a separate route. During testing, Qwen produced confident but unreliable English summaries of Welsh text, so I reviewed these articles manually. The database records which route was used for every article.
Named entities and geographic linking
Qwen also extracted people and places from the newspaper text. Finding a place name was relatively straightforward; linking it to the correct real-world location was much harder.
OCR errors, variant spellings, historical names and ambiguous locations meant that I checked each location used by the maps manually.
Additional charts
Show additional exploratory charts
These charts are retained for reference but are not central to the main account.
Dataset at a glance
These figures describe records in the final project database. An article can match several search terms, mention several people and name several places, so the units are labelled rather than treated as interchangeable.
- 92,371
- unique newspaper articles searched
- 187.3 million
- words of OCR text, covering 1804–1919
- 52
- search terms derived from the glossary
- 95,087
- article–term matches reviewed
- 3,185
- unique articles retained as relevant
- 3,183
- retained articles with structured extraction
- 1,592
- retained articles classified as court reports
- 1,233
- articles identified as reporting prosecutions
- 10,161
- person records extracted from 3,122 articles
- 1,749
- defendant records across the complete 1805–1919 dataset
- 1,903
- distinct place-name entries reviewed or awaiting review
- 1,624
- articles with at least one linked map location
The totals were generated directly from the final SQLite database. They count database records, not necessarily distinct historical people, cases or real-world places.
Conclusion
This project began with a simple question: what would the Queering Glamorgan glossary find in Welsh Newspapers Online?
The search was the easy part. The harder work was filtering the results, turning OCR text into structured data and checking where the automated process had failed.
A limitation of this project is that its classifications reflect both the model and the instructions it was given. The prompt used for structured classification and extraction asks the model not to infer missing facts, but a better prompt could draw sharper boundaries between defendants, complainants, witnesses and people mentioned in neighbouring stories. Refining it against a hand-checked set of examples, including difficult OCR and Welsh-language material, might produce more consistent classifications and fewer incorrect field assignments.
The work was also constrained by the model and computing resources available locally. A larger model, a longer context window or more compute for repeated validation passes might improve the validation success rate, particularly for ambiguous or badly damaged OCR. That is a hypothesis rather than a guarantee: any improvement would need to be measured against the same manually reviewed test set, and stronger automation would not remove the need for human checking.
The next step is to finish the remaining place names and decide which parts of the data and code to publish alongside the visualisations.
