On this page
As part of my Masters dissertation I looked at using Machine Learning to generate IIIF collections.
The aim of this project was to create an end-to-end Natural Language Processing (NLP) workflow that allows annotating of names, training of a machine learning model and inference of a corpus of historical data in order to disambiguate names found within a International Image Interoperability Framework (IIIF) document by linking each name to an entity within a knowledge base (Wikidata), through Named Entity Recognition (NER) and Named Entity Linking (NEL).
The workflow allows researchers to query a database for a specific person or group of people based on a linked-data query, which will generate a collection level IIIF manifest of all articles within the National Library of Wales online Newspaper and Journals which mention that person.
Researchers should be able to query for a single person, such as Robert Owen https://en.wikipedia.org/wiki/Robert_Owen (https://www.wikidata.org/wiki/Q179374)
Which will link to articles, such as:
It should also be possible to generate collections based on multiple Wikidata QIDs, eg finding articles that mention female scientists (https://w.wiki/4RdV)
Miriam Rothschild (https://www.wikidata.org/wiki/Q442167):
Mary Sheridan (https://www.wikidata.org/wiki/Q41791981):
Mary Gillham (https://www.wikidata.org/wiki/Q6779635)
Each named entity is saved to a database where the entity will be recorded with a Wikidata QID reference, along with a reference to the article in which they are mentioned.
Origins of the research question
The origins of the research question came from Amanda Clare while attending a Hackathon at the National Library of Wales in 2017. Amanda suggested that the attendees look at the possibility of identifying Female Scientists within the National Library’s historical online Newspapers and Journals.
Although no one at the Hackathon undertook the challenge, the question does warrant further exploration: ‘Is there available data to identify Female Scientists?’
Looking at the data
The National Library of Wales has a number of online resources, including millions of Newspaper and Journal articles which are freely available. With such large sources of data, discoverability of content becomes challenging.
To understand the needs of consumers of these resources it's worth looking at the search queries to see what information users are looking for. Of the top 500 aggregate queries from a total of 472,725,825 queries performed on Welsh Newspapers, 40.4% of queries were for locations and 38.6% were for people.

The question of finding Female Scientists within historical articles showed there was potential to expand on the question. Identifying all people within historical Newspaper and Journal articles and linking them to an entity within a knowledge base would allow researchers to ask broader questions of the data.
By querying a knowledge base, researchers would be able to identify all Female Scientists and filter the search results by people born within a period of time, nationality or a subset of Science, such as Botany.
Solution
The spaCy library was used alongside the EntityLinker pipeline to train a model that could identify a name within a corpus and attempt to disambiguate that name by linking it to an entity within Wikidata.
Disambiguation
The process of disambiguation is to correctly link a name within a document to an entity within a knowledge base. The knowledge base may contain one or more entities with the same name. Within Wikidata, Jane Seymour may refer to Jane Seymour the actress (https://www.wikidata.org/wiki/Q123849) or Jane Seymour the third wife of Henry VIII of England (https://www.wikidata.org/wiki/Q182637).

Why not use existing NEL?
Training our own model allows the workflow to be more flexible by not depending on third party models that may not have the latest entities from Wikidata/Wikipedia. Data generated by this project, such as identifying new people not found within Wikidata; can be ingested back into Wikidata. This will benefit users of the Wikidata project and form part of the training dataset for future model training.

Process
In order to successfully train a machine learning model that can accurately predict on unseen data the model must first be trained on annotated training data through a process of supervised learning.
To train a machine learning model to disambiguate every person within the Wikidata knowledge base would take a long time to train and be costly to run.
Therefore the only entities from Wikidata that form the annotated training data were initially people from Wales during the prototyping phase, and following successful testing people from the whole of the United Kingdom.
There are 4,272 entities within the Wikidata knowledge base for people from Wales and 177,084 entities for people from the United Kingdom.
Gathering entities from Wikidata
The project utilises two main sources of information to annotate training data, Wikidata and Wikipedia, along with historical Newspaper and Journal articles.

Gathering training data
Once a list of people from Wikidata has been generated, additional training data for those people is required. For each person the first paragraph of their Wikipedia article is retrieved along with every Wikipedia page that links to that article.

Once data has been collected for each entity, the text within that data must be cleaned of misspellings and non-dictionary characters such as HTML tags.
The data for each entity is merged into a JSON document and saved to disk before being ingested into the annotation database.
The validation process includes checking that the name of the person exists in the text and that the string length text is greater than 40 characters and that the person has a Wikipedia page.

Formatting training data
The information within each document must then be separated and transformed into training data through an automated process. This process loops through each source of information and generates a JSON document containing the training text, the start and end character position of the person’s name and their Wikidata QID.

Results
Once a model has been trained it is run against each article in the Newspaper and Journal databases. The model generates a JSON document listing all the names within that article and the character position along with the QID, if the model was able to link it to an entity. The results are then saved to a Solr database.

There were over 226 million names identified in Journal and Newspaper articles. On average 10% of names identified were linked to a Wikidata entity.
| Article type | Total names | Names linked to a QID | Names not linked to a QID |
|---|---|---|---|
| All | 226,501,303 | 23,240,248 | 203,261,055 |
| Journal | 5,685,514 | 610,511 | 5,075,003 |
| Newspaper | 220,815,789 | 22,629,737 | 198,186,052 |
Generating IIIF Collections
Researches are able to create IIIF collections by submitting a SPARQL query to the search interface.

The search interface sends the SPARQL query to Wikidata. Which response with a JSON document of QIDs. These QIDs are then searched within Solr and a IIIF manifest is generated.
IIIF Viewers
The IIIF manifest is viewable by all compatible IIIF viewers, such as the Universal Viewer.

And mirador.

Researches should be able to quickly view the results and annotate the articles from within these viewers.
Linking data
The manifests can be extended further by using linked data to pull in content for each entity. Given a search for Welsh Artists; the workflow should be able to generate a list of articles that mention that artist and include examples of their work.

Limitations
A potential limitation of the use of Wikidata and similar knowledge bases is that the response of a query may contain unexpected results.
For the query of ‘Female Scientists from the United Kingdom’ (https://wiki/4RdV) it will return Margaret Thatcher as an entity (Fig. 8.2.1).

Margaret Thatcher is commonly known for being the Prime Minister of the United Kingdom from 1979 until 1990, but worked as a research Chemist prior to becoming a member of parliament. Therefore Wikidata lists one of her occupations as Chemist.


Discovering new people
One way to identify new people is by searching the entities database for each Wikidata QID and calculating how many have been mis-attributed by comparing the date of birth of the person to the published date of the article.
Kyffin Williams (https://www.wikidata.org/wiki/Q6450928) appears 167 times in the database. However, when searching for articles linked to QID Q6450928 before 1918 (Kyffin Williams date of birth) there are 133 articles incorrectly attributed to Q6450928. This is due to only a single instance of Kyffin Williams existing in the knowledge base
In order to correct the issue and to create a new Wikidata entry for Kyffin Williams, the articles published before the birth of Kyffin Williams the artist were validated, such as:
These articles mention the name Reverend O. Kyffin Williams. A number of articles mention the passing and funeral of this person in 1917 (https://newspapers.library.wales/view/4243951/4243953/23).

By looking at online resources such as Ancestry it was possible to narrow down this person as Owen Kyffin Williams, who passed away in 1917 and buried in Llangwyllog, Anglesey. Which matches the information in the Newspaper articles.

Given this information a new Wikidata record was created for this person (https://www.wikidata.org/wiki/Q112080114). Which lists all available information such as Name, Description, date of birth, date of death and burial location.
Workflow
The image below shows the complete workflow that was created for this project.

Research possibilities
It is possible to create a graph of relationships of names that appear most often together in articles. The NEL database produces 59,052 Nodes and 1,259,521 Edges.
One degree of separation for David Lloyd George and people named in the same article.

The following names appear the most alongside David Lloyd George.
| Name | QID | Occurrences |
|---|---|---|
| Kenneth O. Morgan | Q936577 | 18 |
| Clement Davies | Q5131308 | 14 |
| Tom Ellis | Q3403520 | 12 |
| Herbert Lewis | Q5734947 | 12 |
| T. E. Ellis | Q7668222 | 11 |
| William George | Q19430286 | 10 |
| A. J. P. Taylor | Q706931 | 9 |
| Thomas Gee | Q3399836 | 8 |
| Henry Richard | Q5727523 | 6 |
| Basil Blackwell | Q4867117 | 5 |
| Anthony Eden | Q128995 | 4 |
Knowledge Graph
Given a topic, such as the Aberfan Disaster, researchers could query for all entities that appear within articles about that topic. Given the frequency names appear within those articles it will be possible to identify key people within a given topic.
Similar to how search engines, such as Bing.com, use knowledge graphs to identify people of interest.

Applying this idea to the Newspaper dataset and running a query for Gallipoli between February 1915 and January 1916 and counting the results in the NEL database returns the names most reported.
Fought during the First World War (1914-18) from 25 April 1915 to 9 January 1916, Gallipoli was the first major amphibious operation in modern warfare. British Empire and French troops landed on the Ottoman-held peninsula in the Dardanelles Straits with disastrous consequences for the Allies. National Army Museum (2019). Gallipoli campaign | National Army Museum. [Online] Nam.ac.uk. Available at: https://www.nam.ac.uk/explore/gallipoli [Accessed 16 May 2022].
| Name | QID | Occurrences | Notes |
|---|---|---|---|
| Ian Hamilton | Q699617 | 88 | British Army officer. Ian Hamilton on Wikipedia. |
| John French | Q335059 | 42 | Senior British Army officer. John French on Wikipedia. |
| Lloyd George | Q134982 | 42 | British politician and Prime Minister. David Lloyd George on Wikipedia. |
| Achi Baba | N/A | 41 | Incorrectly labelled as a person. Achi Baba (Turkish: Alçıtepe) is a height dominating the Gallipoli Peninsula in Turkey, located in Çanakkale Province. Achi Baba on Wikipedia. |
| M.A. | N/A | 19 | Incorrectly labelled as a person. |
| Gaba Tepe | N/A | 18 | Incorrectly labelled as a person. |
| Ari Burnu | N/A | 16 | Incorrectly labelled as a person. Gaba Tepe is a headland overlooking the northern Aegean Sea. Kabatepe on Wikipedia. |
| Charles Monro | Q955637 | 15 | British Army general in the First World War. Charles Monro on Wikipedia. |
| Edward Grey | Q335187 | 14 | British Liberal statesman. Edward Grey on Wikipedia. |
| Ian Hamilton | Q699617 | 12 | British Army officer. Ian Hamilton on Wikipedia. |
