Overview
I created a program to generate TEI/XML files containing OCR results from IIIF manifest files. This article explains how to use it.

How It Works
By specifying the URL of an IIIF manifest file, it creates a TEI/XML file containing OCR results from NDL Kotenseki OCR-Lite.
https://github.com/ndl-lab/ndlkotenocr-lite
Usage
Access the following notebook:
Then press the first play button.

Once complete, update the manifest_url and output_dir values in the “Execute” section and run the cell.
The TEI/XML file containing OCR results will be output to output_dir.

Output Example
A file containing OCR results per page and per line is created as follows:
<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<fileDesc>
<titleStmt>
<title>OCR結果: https://iiif.dl.itc.u-tokyo.ac.jp/repo/iiif/0f11a3ed-18c2-7322-6340-19ed3f0d966e/manifest</title>
</titleStmt>
<publicationStmt>
<publisher>NDL古典OCR</publisher>
<date>2025-01-29</date>
</publicationStmt>
<sourceDesc>
<bibl>
<ptr target="https://iiif.dl.itc.u-tokyo.ac.jp/repo/iiif/0f11a3ed-18c2-7322-6340-19ed3f0d966e/manifest"/>
</bibl>
</sourceDesc>
</fileDesc>
</teiHeader>
<text>
<body>
<ab n="1" type="page" facs="https://iiif.dl.itc.u-tokyo.ac.jp/iiif/soto_ogai_202310/A05_4/002/A05_4_002_0001.tif/full/full/0/default.jpg">
<lb/>
<seg type="本文" n="1" corresp="#zone-1">国外</seg>
<lb/>
<seg type="本文" n="3" corresp="#zone-3">空せみ二</seg>
<lb/>
<seg type="本文" n="4" corresp="#zone-4">ゆふかほ</seg>
</ab>
<ab n="2" type="page" facs="https://iiif.dl.itc.u-tokyo.ac.jp/iiif/soto_ogai_202310/A05_4/002/A05_4_002_0002.tif/full/full/0/default.jpg">
<lb/>
<seg type="本文" n="1" corresp="#zone-1">あつたい</seg>
<lb/>
<seg type="本文" n="2" corresp="#zone-2">・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・</seg>
<lb/>
<seg type="本文" n="3" corresp="#zone-3">中川ノ中川宿にて之源氏十六才</seg>
<lb/>
<seg type="本文" n="4" corresp="#zone-4">住ぬ</seg>
<lb/>
<seg type="本文" n="5" corresp="#zone-5">ねられ給はぬまゝに。われはかく人に</seg>
<lb/>
<seg type="本文" n="6" corresp="#zone-6">にくまれてもならはぬを。こよひなん</seg>
<lb/>
<seg type="本文" n="7" corresp="#zone-7">はじめてうしと世を思ひ知ぬれば</seg>
<lb/>
<seg type="本文" n="8" corresp="#zone-8">はつかしうてながらふまじくこそ思ひ</seg>
<lb/>
<seg type="本文" n="9" corresp="#zone-9">なりぬれなどの給へば。なみたをさへ</seg>
<lb/>
<seg type="本文" n="10" corresp="#zone-10">こぼしてふしたり。いどらうたしと</seg>
<lb/>
<seg type="本文" n="11" corresp="#zone-11">おぼすてさぐりのほそくちいさき</seg>
<lb/>
<seg type="本文" n="12" corresp="#zone-12">ほどがみのいとながからざりしけ</seg>
<lb/>
Summary
There may be some incomplete aspects, but I hope this serves as a useful reference.