Datasets:
The dataset viewer should be available soon. Please retry later.
Honkoku-Lines
A million-scale line-level image–transcription dataset for historical Japanese OCR, built from crowdsourced transcriptions.
Honkoku-Lines is a dataset of line-level images paired with diplomatic transcriptions, drawn from premodern Japanese documents held by IIIF-compliant institutions. It is derived from the Minna de Honkoku citizen-transcription platform by automatically aligning crowdsourced page-level transcriptions with detected line regions.
This HuggingFace release contains the redistributable subset: line images whose source license is either CC-BY-4.0 or Public Domain Mark (PDM-1.0). For items under more restrictive licenses, an IIIF-fetching script is provided to assemble the full dataset client-side.
Dataset summary
| Records (this release) | ~998,000 line images |
| Records (full dataset) | 1,152,856 lines |
| Source items | 4,197 items (3,825 in this release) |
| Institutions | 32 IIIF-compliant providers |
| Format | WebDataset (POSIX tar, h=256 JPEG, deterministic preprocessing) |
| Splits | None imposed; recommend item_id hash-based split (see §Splits) |
Citation
A data paper describing this resource is in preparation. In the meantime, please cite the archived deposit:
Hashimoto, Y., Aoike, T., Hamano, M., Kano, Y., Nakanishi, I., & Ohmura, J. (2026). Honkoku-Lines: A million-scale line-level image–transcription dataset for historical Japanese OCR [Data set]. Zenodo. https://doi.org/10.5281/zenodo.20656129
What's in this release
This HuggingFace release distributes the redistributable subset of the dataset — line images whose source rights permit redistribution under CC-BY-4.0 or Public Domain Mark.
- 998,130 lines (86.6 % of the full clean release)
- 3,825 items (91.1 % of the 4,197 total)
- 237 WebDataset tar shards (~500 MB each)
- Companion metadata:
items.tsv,lines.jsonl.gz,hosts.tsv
The remaining 154,726 lines, under more restrictive licenses (CC-BY-SA-4.0, NC/ND variants, etc.) or unspecified rights, are not bundled but can be reconstructed using the IIIF-fetching script (examples/fetch_iiif.py) and the lines.jsonl.gz metadata.
Loading the dataset
from datasets import load_dataset
ds = load_dataset("yuta1984/honkoku-lines", split="train", streaming=True)
for sample in ds:
img = sample["jpg"] # PIL Image (h=256, JPEG q92)
text = sample["txt"] # raw koji-notation transcription
meta = sample["json"] # full metadata (item_id, bbox, image_license, etc.)
Or directly via the webdataset library:
import webdataset as wds
ds = wds.WebDataset("data/data-{000000..000236}.tar")
Sample structure
Each sample consists of three files sharing the same __key__ (= <item_id>_<image_index>_<line_index:03d>, identical to the image_id field in the JSON):
| Member | Content |
|---|---|
<key>.jpg |
Line image, h=256 px (JPEG q92, 4:4:4, max width 2048 px) |
<key>.txt |
Gold transcription with original koji notation preserved |
<key>.json |
Full per-line metadata (see below) |
.json metadata fields
Each sample's <key>.json carries the 19 fields below. The companion lines.jsonl.gz file uses the same schema (same field names, types, and semantics), so users can join or substitute the two sources without translation.
{
"image_id": "ITEMID_PAGE_LINE",
"item_id": "E2C17A0085D898AC163CB1DB37125183",
"project_id": "ina",
"iiif_host": "dl.ndl.go.jp", // IIIF provider domain
"image_index": 0, // page-image index within the item
"line_index": 0, // line index within the page image
"iiif_image_url": "https://.../full/full/0/default.jpg",
"iiif_region_url": "https://.../X,Y,W,H/full/0/default.jpg",
"bbox": [x, y, w, h],
"text": "懐《割書:ふところ|むね》悔",
"plain_text": "懐ふところむね悔",
"plain_len": 7,
"ocr_text": "懐ふところむね悔",
"edit_distance": 0.0, // gold ↔ ocr_text normalised Levenshtein
"source": "body", // always "body" in bundled tars
"image_license": "CC-BY-4.0",
"image_license_url": "https://creativecommons.org/licenses/by/4.0/deed.ja",
"holding_institution": "東京大学地震研究所図書室",
"split": "train" // train / val / test (recommended)
}
text preserves the original diplomatic markup; plain_text is the markup-stripped form (warigaki contents retained, marginal annotations removed). For the markup specification see the Minna de Honkoku documentation.
Companion files
| File | Description |
|---|---|
items.tsv |
Per-item bibliographic and license metadata (4,197 rows) |
lines.jsonl.gz |
Per-line metadata for all 1.15 M lines (incl. non-bundled), with IIIF URLs. Same per-record schema as the tar .json files. Additional source values (enrichment_rejected_nonwari, enrichment_v8_reocr) appear for enrichment rows not present in the bundled tars. |
hosts.tsv |
Per-host (institution) aggregated metadata, license summary |
lines.jsonl.gz is the authoritative manifest; the bundled tars contain only the rows with image_license ∈ {CC-BY-4.0, PDM-1.0}.
Reconstructing the full dataset
The non-redistributable subset (154,726 lines) can be fetched from each institution's IIIF Image API:
python examples/fetch_iiif.py --out-tar full-extension.tar --rate 3.0
Default rate-limit is 3 seconds between requests per host (5 seconds for gallica.bnf.fr), per IIIF community conventions. The script reads lines.jsonl.gz and downloads only entries not already in this release.
Pipeline
Each page passes through seven stages:
- Image retrieval from the IIIF Image API.
- Layout detection using koten-layout-detector (ONNX).
- Line cropping with dual margins (10 px tight for OCR, 45 px generous for redistribution).
- OCR using PARSeq (NDL Kotenseki OCR-Lite, 7,141-character recogniser).
- Alignment via normalised Levenshtein distance between OCR output and the crowdsourced transcription split into per-line gold.
- Acceptance at normalised distance ≤ 0.4.
- Layout-consistency check removing lines where the gold concatenates multi-column ledger fields that the crop does not fully capture (calibrated precision 0.97, recall 0.98; 59,040 lines removed).
OCR is used as a key for alignment, not as ground truth.
Splits
No official train/validation/test split is imposed. We recommend item-level separation to avoid leakage from pages of the same source item:
import hashlib
def split_of(item_id, seed=0):
h = hashlib.md5(f"{seed}:{item_id}".encode()).hexdigest()
b = int(h[:4], 16) % 1000
return "train" if b < 900 else "val" if b < 950 else "test"
This matches the split column in items.tsv and yields ≈ 90 / 5 / 5 % at the item level.
License
This dataset bundles content under two licenses, identifiable per-record via the image_license field in the metadata:
- CC-BY-4.0 — 419,362 lines (42.0 %). Attribution required.
- Public Domain Mark (PDM-1.0) — 578,768 lines (58.0 %). No rights reserved.
Crowd-sourced transcription text (the text and plain_text fields) and curation metadata are released under CC-BY-SA-4.0. The pipeline source code is released under MIT and archived, together with the line-level companion metadata, on Zenodo: doi.org/10.5281/zenodo.20656129.
Per-institution attribution
All 32 contributing institutions, in descending order of line count. License terms apply per record (see the image_license field in items.tsv). When using or redistributing this dataset, please attribute the underlying institutions in accordance with their license terms.
| Institution | License | Lines |
|---|---|---|
| 国立国会図書館 National Diet Library, JAPAN | PDM-1.0 | 290,396 |
| 東京大学地震研究所図書室 Earthquake Research Institute Library, The University of Tokyo | CC-BY-4.0 | 143,689 |
| 伊那市立高遠町図書館・合同会社AMANE | CC-BY-4.0 | 140,919 |
| 福井県文書館 Fukui Prefectural Archives | PDM-1.0 | 117,909 |
| 京都大学古地震研究会 Kyoto University Historical Earthquake Research Group | PDM-1.0 | 86,782 |
| 会津若松市立会津図書館 Aizu Library, Aizuwakamatsu City | CC-BY-4.0 | 82,376 |
| 国文学研究資料館 National Institute of Japanese Literature (国書 DB) | (unspecified) | 80,518 |
| 味の素食の文化センター・国文学研究資料館 Ajinomoto Foundation for Dietary Culture / NIJL | CC-BY-SA-4.0 | 66,770 |
| 京都大学附属図書館 Kyoto University Library | FREE LICENSE with Attribution | 50,491 |
| University of the Ryukyus Library | PDM-1.0 | 44,238 |
| 東京学芸大学教育コンテンツアーカイブ Tokyo Gakugei University Educational Content Archive | PDM-1.0 | 37,882 |
| 九州大学附属図書館 Kyushu University Library | PDM-1.0 | 32,041 |
| 鳴門教育大学 Naruto University of Education | CC-BY-4.0 | 20,376 |
| 石川県立図書館 Ishikawa Prefectural Library | PDM-1.0 | 6,278 |
| バチカン図書館 Vatican Library | (unspecified) | 2,143 |
| 慶應義塾大学メディアセンター Keio University Libraries | (unspecified) | 1,676 |
| 国立科学博物館 National Museum of Nature and Science | CC-BY-NC-4.0 | 1,660 |
| メトロポリタン美術館 The Metropolitan Museum of Art | PDM-1.0 | 1,184 |
| 国立国語研究所 National Institute for Japanese Language and Linguistics (NINJAL) | CC-BY-4.0 | 1,025 |
| 筑波大学附属図書館 University of Tsukuba Library | RS-NOC-CR | 874 |
| 千葉大学附属図書館 Chiba University Library | RS-NOC-CR | 652 |
| 大阪大学附属図書館 Osaka University Library | (unspecified) | 556 |
| 龍谷大学図書館 Ryukoku University Library | (unspecified) | 498 |
| 神戸大学附属図書館 Kobe University Library | (unspecified) | 415 |
| 立命館大学アート・リサーチセンター Art Research Center, Ritsumeikan University | (unspecified) | 256 |
| 東京大学地震研究所 Earthquake Research Institute, The University of Tokyo | (unspecified) | 173 |
| 国立歴史民俗博物館 National Museum of Japanese History | CC-BY-SA-4.0 | 48 |
| 算額アーカイブ Sangaku Archive | CC-BY-NC-SA-4.0 | 41 |
| 岡山大学附属図書館 Okayama University Library | (unspecified) | 28 |
| バイエルン州立図書館 (Münchner Digitalisierungszentrum) Bavarian State Library | PDM-1.0 | 2 |
Note: lines counts above reflect the full clean release (1,152,856 lines). The HuggingFace bundled subset (998,130 lines) is restricted to records under CC-BY-4.0 or PDM-1.0; for the remaining records, IIIF URLs in lines.jsonl.gz enable client-side reconstruction.
Limitations
- Transcriptions are crowdsourced and peer-reviewed on a citizen-science platform achieving approximately 98.5 % character-level accuracy; a small fraction of characters may be erroneous.
- Edit-distance-based alignment can introduce occasional line-level mismatches, more frequent in the 0.3–0.4 distance band.
- The layout-consistency filter operates at calibrated precision 0.97 and recall 0.98, so a small residue of incorrectly captured multi-column lines may remain.
- Diplomatic markup is preserved as transcribed but is not uniformly applied across volunteers.
- Old- and new-form kanji are not normalised.
- The corpus is unevenly distributed across institutions, with the four largest contributors accounting for over half of all records.
Related resources
- Source platform — Minna de Honkoku (https://honkoku.org/)
- Source transcriptions — honkoku-data
- Pipeline code & companion metadata — archived on Zenodo: doi.org/10.5281/zenodo.20656129
- Prior line-level dataset — National Diet Library Lab (2023), NDL古典籍OCR学習用データセット(みんなで翻刻加工データ) — github.com/ndl-lab/ndl-minhon-ocrdataset
Acknowledgements
We thank the more than ten thousand citizen transcribers of the Minna de Honkoku community whose voluntary, peer-reviewed work over nearly a decade made this dataset possible. We thank the 32 institutions providing IIIF-compliant access to their holdings. We acknowledge the National Diet Library Lab for the Kotenseki OCR-Lite model used in alignment. This work was supported by JSPS KAKENHI grants 25H01243 and 26H02553.
Contact
For questions or to report issues, please use the Community tab of this dataset.
- Downloads last month
- 494