
OCR output post-processing and quality control (text-line categorization) - ATRIUM
Builds the ATRIUM document record of a document from its layout, and judges every text line in it. The layout is docproc, which AIS CR's text-recognition service writes for scanned pages and the ATRIUM born-digital converter for born-digital files; for a document with both kinds of pages the two are merged, keeping the exact text layer where it is good. The record holds a row for every page of the original, the lines in reading order with their boxes, and the document's text. Every line is labelled with its language, a quality score and one of five categories: Clear, Noisy, Trash, Non-text or Empty. The score combines structural checks, character-level measures and a small language model's perplexity; the language comes from a language-identification model, and passes over the whole document correct isolated mistakes.
For research collections the same labelling runs as a batch pipeline over ALTO XML and other OCR output (PAGE XML, hOCR, ABBYY FineReader XML, DjVuXML, Tesseract TSV, OCR JSON), and over text-bearing files such as PDF text layers, office documents, EPUB, HTML, TEI or plain text. It splits documents into pages, builds page statistics, extracts each page's text in reading order, from the ALTO geometry or with a layout-aware model, and writes per-line tables (CSV) and page statistics.
REST API container image (ghcr.io/ufal/atrium-ocr-postprocess-api): /build_record builds and scores the record from docproc, /score_record scores the lines of an existing record again, and /process labels the lines of one research upload. The command line does the same (build_record.py, score_record.py, and the batch pipeline). Every run records its provenance (paradata). The tool continues atrium-alto-postprocess under a new name.
In the ATRIUM pipeline it is the record builder: it reads the docproc that AMČR stores for the document and writes the ATRIUM document record, with the document's identity from AMČR's seed. It is the only tool that scores lines; the page classifier, the NLP enrichment and the keyword extraction then add to the same record. A docproc it cannot read in full fails the job, and nothing is written. The record and who writes what in it: the document contract.
The code is MIT.
| Component | Licence | Used when |
|---|---|---|
| alto-tools (vendored) | Apache-2.0 | Listed by every run; page split, statistics and text extraction in ALTO's own order. |
| FastText language identification | CC BY-NC 4.0 | Listed by every run; the language of each line. |
| Qwen2.5-0.5B; distilgpt2 | Apache-2.0 | The perplexity model: Qwen2.5-0.5B by default, distilgpt2 as the English-only alternative. |
| LayoutReader (LayoutLMv3) | CC BY-NC-SA 4.0 | Layout-aware reading order of ALTO pages: the batch's default method, and /process on ALTO. |
| GLM-4v-9b (optional) | GLM-4 model licence | Only the batch's GLM method (OCR from page images), on the command line; the model's own terms apply. |
| pypdfium2; charset-normalizer | Apache-2.0; MIT | Reading PDF text layers; reading plain text that is not UTF-8. |
Each run lists the components it used, each with its own licence or terms. None of these is the licence of the output: the rights in an output depend first on the source document, and only their holder can state them (Licences and paradata).
Related items(1)
Workflow
The SSH Open Marketplace is maintained and will be further developed by three European Research Infrastructures - DARIAH, CLARIN and CESSDA - and their national partners. It was developed as part of the "Social Sciences and Humanities Open Cloud" SSHOC project, European Union's Horizon 2020 project call H2020-INFRAEOSC-04-2018, grant agreement #823782.


