Skip to content

DHBern/death_register_extraction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

death_register_extraction

Extraction of Zurich death register entries using VLM + LLM post-processing.

Project Background This project operationalizes the workflow described in the poster "Informationsextraktion serieller Quellen: Die Zürcher Sterberegister (1876–1925)". The goal is to convert scanned serial sources (e.g., civil and church registers) into structured tables without much manual correction by combining layout analysis, automatic text recognition (ATR), and large language models (LLMs). The project evaluates closed (Transkribus, OpenAI) and open (YOLO, TrOCR, Qwen) toolchains to deliver a reproducible pipeline for historical sources.

Poster Workflow Summary

  1. Visual Language Model QWEN3 is used to perform text-region detection and ATR.
  2. LLM-based reconstruction and extraction to normalize order and identify fields via keyword windows.
  3. Validation and correction to quantify errors and improve models or apply rule-based fixes.

Poster Figures (From Project Documentation) Layout segmentation example Figure 1: Document with layout regions marked (Transkribus screenshot, Fields model, Zurich 1876 register).

Line segmentation and OCR example Figure 2: Layout/line segmentation + OCR output showing disrupted line order (Transkribus screenshot).

CSV output example Figure 3: CSV output after segmentation, OCR, extraction, and post-processing (VSC screenshot).

What This Repo Does This repo contains several standalone scripts that form a loose pipeline for:

  1. Detecting text-regions and performing ATR with a VLM
  2. Converting OCR output into PAGE-XML for downstream tools.
  3. Extracting structured fields from PAGE-XML and/or raw CSV via LLMs.

The scripts are currently configured with hardcoded local paths and hardcoded API keys. You will need to change those constants before running.

Scripts Overview

  • qwen3_approach_PDFtoText_V3.py
    Resizes original image, automatically crops the image and sends it to an API that runs a qwen-model Inputs: Images/PDFs in input Outputs: Page-XML with detexted text in output and a logs.txt file containing the terminal outputs The page-XML contains two seperated cases which contain plain detected text

  • keywordextraxtion_qwen.py
    Takes the Page-XML, sends it with an attached prompt to an API that runs a qwen-model, cleans and files the returned text into a CSV Inputs: Page_XML in output Outputs: CSV with extracted text in extraction_output CSV-Layout: Filename,XML_Block_Index,time_of_death,place_of_death and reason_for_death,"name/occupation/father,mother/civil_status/place_of_origin/hometown/confession",place_of_residence/birthdate The CSV-Laout depends entirely on the structure of the original data and the prompt used to extract the information

  • LEO_csv_gpt-oss_V6.py
    Takes the CSV-file and performs a deeper extraction by using the LLM "gpt-oss-120b" Inputs: CSV in extraction_output Outputs: CSV with further extracted and filed data in llm_output The script used performs a deeper analysis of the already extracted data and categorizes that data into smaller sections

Pipeline (Typical Usage)

  1. Run qwen3_approach_PDFtoText_V3.py to generate a PAGE-XML containing two sections with recognized texts
  2. Run keywordextraxtion_qwen.py to extract core content of the text in the PAGE-XML
  3. Run LEO_csv_gpt-oss_V6.py to perform a deeper and more precise filing of the already extracted data

Configuration You Must Edit

  • qwen3_approach_PDFtoText_V3.py
    • input, output , logs
    • Prompt
    • API-Key, base_url, model
    • vertical_seperator, horizontal_seperator
  • keywordextraxtion_qwen.py
    • input, output
    • Prompt
    • API-Key, base_url, model
  • LEO_csv_gpt-oss_V6.py
    • input, output
    • Prompt
    • API-Key, base_url, model
    • evaluate_df

Dependencies Install the Python packages used by each script:

  • Core: pandas, tqdm, openai, requests
  • PDF rendering: pymupdf (imported as fitz)
  • XML: lxml

Notes / Caveats

  • The VLM and the extraction_scripts can make errors, manuall checks are still needed
  • Most paths are Windows-style and must be updated to your local environment.

About

Extraction of Death Register's from Zurich

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages