IIIFマニフェストファイルからOCR結果を含むTEI_XMLファイルを作成するプログラム
概要 IIIFマニフェストファイルからOCR結果を含むTEI_XMLファイルを作成するプログラムを作成しました。このプログラムの使用方法について説明します。 仕組み IIIFマニフェストファイルのURLを指定して、NDL古典籍OCR-LiteによるOCR結果を含むTEI/XMLファイルを作成します。 https://github.com/ndl-lab/ndlkotenocr-lite 使い方 以下のノートブックにアクセスしてください。 https://colab.research.google.com/github/nakamura196/000_tools/blob/main/IIIFマニフェストファイルからTEI_XMLファイルを作成するプログラム.ipynb そして、一つ目の再生ボタンを押します。 完了したら、「実行」という部分のmanifest_urlとoutput_dirの値を更新して、セルを実行します。 output_dirに、OCR結果を含むTEI/XMLファイルが出力されます。 出力例 以下のように、ページおよび行ごとのOCR結果を含むファイルが作成されます。 <?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/> まとめ 不完全な点もあるかと思いますが、参考になりましたら幸いです。 ...


















