File size: 129,510 Bytes
f9bc0c1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 | # Limbu-First OCR Pipeline
Updated: 2026-06-22
## Goal
Build the operational OCR path for Limbu pages before expanding the claim: imperfect
still-page captures should be cleaned and parsed through a pipeline that can handle
both Devanagari-written Limbu and Sirijonga-script Limbu, preserve line provenance,
route or flag script-specific recognition risk, and emit review/audit artifacts for
every page. The product boundary is a robust two-script Limbu OCR pipeline; any
moving-camera workflow must first provide still page images to this pipeline and is
not a separate video-to-page objective. This is a production digitization goal, not a
CER claim by itself; claim-grade accuracy still requires frozen references and
`run_page_ocr_eval.py`.
One-line objective prompt:
> Build a best-in-class, claim-audited Limbu OCR pipeline for real page images that understands both Devanagari-written Limbu and Sirijonga-script Limbu, with script-aware detection/recognition, page cleanup, language-specific correction, confidence review queues, and frozen page-level eval before any quality claim.
## Current Entry Point
Check that the packaged mixed-script router can run on the machine:
```bash
uv run ocrtech preflight-limbu-pipeline \
--model-config outputs/limbu-first-router-v1/model-card.json \
--out outputs/limbu-first-router-v1/runtime-preflight
```
For operational two-script readiness, use the stricter component-admission gate:
```bash
uv run ocrtech preflight-limbu-pipeline \
--model-config outputs/limbu-first-router-v1/model-card.json \
--out outputs/limbu-first-router-v1/runtime-preflight-strict \
--require-validated-components \
--required-component-role devanagari_primary \
--required-component-role sirijonga_secondary
```
The loose preflight only answers whether the runtime and model-card wiring are usable.
The strict preflight is the one that must pass before calling the mixed-script router
ready: both the Devanagari primary and Sirijonga secondary must be recorded in
`provenance.component_admission` with `validated` or `admitted` status. The JSON and
Markdown reports record the enforced policy, including required Tesseract languages,
strict component mode, and required component roles; malformed component-admission
entries fail instead of disappearing from the audit.
Preserve and normalize the capture first:
```bash
uv run ocrtech prepare-limbu-capture path/to/raw-page.jpg --out outputs/limbu-page-prep \
--auto-detect-page \
--auto-deskew \
--rotate-degrees -1.5 \
--crop-box 40,80,1900,2840
```
For difficult pages, manual corners can still override automatic detection:
```bash
uv run ocrtech prepare-limbu-capture path/to/raw-page.jpg --out outputs/limbu-page-prep \
--crop-box 40,80,1900,2840 \
--perspective-quad 30,40,1780,20,1810,2600,60,2630 \
--auto-deskew
```
Audit the prepared capture bundle before OCR:
```bash
uv run ocrtech audit-limbu-capture outputs/limbu-page-prep \
--require-metadata-path-self
```
For multi-page books or a batch of still frames, put the page images in a directory and
run the book OCR runner directly. It scans supported image files in natural filename
order, generates the raw page manifest with image hashes, prepares every page, writes
the prepared OCR manifest, parses the book in preserve-line mode, writes aggregate
editable text and review queues, and runs the book artifact audit. This is the default
operator command for real photographed pages:
```bash
PYTHONPATH=src /tmp/ocrtech-paddle311/bin/python tools/run_limbu_book_ocr.py \
--image-dir path/to/page-images \
--out outputs/limbu-book-ocr-run \
--page-id-prefix limbu-book-p \
--auto-deskew \
--max-auto-deskew-degrees 8 \
--min-prepared-width 1000 \
--min-prepared-height 1000 \
--min-prepared-entropy 0.5 \
--min-prepared-luminance-stddev 1.0 \
--min-prepared-edge-stddev 1.0
```
If the folder contains non-target pages, covers, duplicate captures, or an exported
source pack with mixed language candidates, filter it before OCR:
```bash
PYTHONPATH=src /tmp/ocrtech-paddle311/bin/python tools/run_limbu_book_ocr.py \
--image-dir path/to/page-images \
--out outputs/limbu-book-ocr-run \
--page-id-prefix limbu-book-p \
--include-filename-regex '.*-01\.png$' \
--skip-duplicate-images \
--auto-deskew
```
`--include-filename-regex` keeps only filenames matching the regex,
`--exclude-filename-regex` drops known non-target filenames, and
`--skip-duplicate-images` skips later files with the same SHA-256 content as an earlier
kept image. The generated manifest summary records discovered, skipped, duplicate, and
kept images so a mixed folder cannot silently masquerade as a clean Limbu book. The
manifest builder and runner also emit source attention flags: `source_images_skipped`,
`duplicate_source_images_removed`, or `duplicate_source_images_present`.
The key outputs are:
- `raw-page-manifest/book-pages.jsonl`: generated page manifest with source image hashes.
- `capture-prep/prepared-page-manifest.jsonl`: prepared-image manifest with bound capture metadata.
- `capture-prep/capture-prep-dashboard.html`: raw/prepared page contact sheet for checking crop, deskew, perspective, and prepared-image quality before OCR review.
- `book-ocr/book.md` and `book-ocr/book.body.md`: editable full/body book text.
- `book-ocr/book-line-review-queue.tsv`: review sheet for weak or unresolved lines, including source crop paths and SHA-256s.
- `book-ocr/book-review-dashboard.html`: crop-linked contact sheet for the book-line review queue.
- `layout-gap-review/layout-gap-review-queue.tsv`: crop-linked review rows for suspicious vertical gaps between detected text rows, including a full-page context image path/hash with the gap band highlighted.
- `layout-gap-review/layout-gap-review-dashboard.html`: contact sheet for the suspicious gap crop bands and their page context.
- `limbu-book-ocr-run.json`: run summary with counts, hashes, audit result, per-page line/script/review counts, and operator attention flags.
- `README.md`: operator summary, including source image discovery/skip/duplicate counts when `--image-dir` is used.
Source attention flags are ingestion triage signals. `duplicate_source_images_present`
means the run kept duplicate image content and should not be treated as a clean book
batch until the manifest is filtered or rerun with `--skip-duplicate-images`.
Operator attention flags are triage signals, not quality metrics. They mark pages with
zero detected lines, all or many lines in review, high `other` script share, suspicious
line-geometry gaps (`possible_missed_line_gap`), unavailable line geometry, or failed
page artifact audit so the next human action is obvious: inspect the page, reshoot or
recrop if needed, then work through the crop-bound review queue. The geometry-gap flag
is computed from final `document.json` line boxes and catches unusually large vertical
holes between detected rows even when confidence/script counts otherwise look healthy;
structural page-marker footers are ignored so ordinary bottom page numbers do not trip
the warning. Each suspicious gap also gets a crop-bound pending row in
`layout-gap-review/layout-gap-review-queue.tsv`, so an operator can inspect the actual
page band and the highlighted full-page context before deciding whether a missing line
needs to be inserted.
If page order needs manual correction or a page needs per-page crop/perspective
settings, build or edit the raw manifest first. Each row needs `page_id` and
`image_path`; optional per-page `capture_kwargs` can override rotation, crop,
perspective, and deskew settings for difficult pages.
```bash
uv run python tools/build_limbu_book_page_manifest.py \
--image-dir path/to/page-images \
--out outputs/limbu-book-pages.jsonl \
--page-id-prefix limbu-book-p \
--include-filename-regex '.*-01\.png$' \
--skip-duplicate-images
```
Then run the same OCR runner on that manifest:
```bash
PYTHONPATH=src /tmp/ocrtech-paddle311/bin/python tools/run_limbu_book_ocr.py \
--page-manifest outputs/limbu-book-pages.jsonl \
--out outputs/limbu-book-ocr-run \
--auto-deskew
```
The lower-level capture/parse split is still available for debugging. First prepare the
raw manifest:
```bash
uv run python tools/prepare_limbu_book_captures.py \
--page-manifest path/to/raw-book-pages.jsonl \
--out outputs/limbu-book-capture-prep \
--auto-deskew \
--max-auto-deskew-degrees 8
```
Then run the book parser on the generated manifest. Preserve detected lines, bind
capture provenance, and send weak rows to review instead of deleting them with
confidence filters:
```bash
PYTHONPATH=src /tmp/ocrtech-paddle311/bin/python tools/parse_limbu_book_pages.py \
--page-manifest outputs/limbu-book-capture-prep/prepared-page-manifest.jsonl \
--out outputs/limbu-book-ocr-preserve \
--engine candidate \
--model-config outputs/limbu-router-v4-ppocr-devanagari-sirijonga-confidence-guard-2026-06-22/model-card.json
```
Then run `parse-limbu-doc` on the prepared image:
```bash
uv run ocrtech parse-limbu-doc outputs/limbu-page-prep/prepared/raw-page.prepared.png \
--out outputs/limbu-page-run \
--engine candidate \
--model-config outputs/limbu-first-router-v1/model-card.json \
--capture-prep-metadata outputs/limbu-page-prep/limbu-capture-prep.json \
--post-correction-profile path/to/limbu-post-correction-profile.json \
--low-confidence-threshold 0.80 \
--sirijonga-low-confidence-threshold 0.85 \
--devanagari-low-confidence-threshold 0.80 \
--script-ratio-threshold 0.20
```
When `--capture-prep-metadata` is supplied, `parse-limbu-doc` reruns the capture audit
into `capture-prep-audit/`, fails if the prepared/raw bundle is stale or incomplete, and
fails if the OCR input path does not match the audited `prepared_image_path`.
Later, `audit-limbu-output` reruns that capture audit from the embedded metadata path
into `capture-prep-replay-audit/`, so a prepared image tampered after OCR cannot keep
passing on the stale bundled audit. Strict output audits can also pass prepared-image
quality thresholds through to that replay with `--min-capture-prepared-width`,
`--min-capture-prepared-height`, `--min-capture-prepared-entropy`,
`--min-capture-prepared-luminance-stddev`, and
`--min-capture-prepared-edge-stddev`, plus
`--require-capture-metadata-path-self` when the final OCR output audit must enforce the
same metadata self-binding as the capture audit. Use
`audit-limbu-capture --require-metadata-path-self` for claim-grade capture bundles so
the recorded `metadata_path` must resolve to the exact `limbu-capture-prep.json` being
audited, instead of merely warning after a copied or renamed metadata file.
Audit the OCR output bundle before review or eval:
```bash
uv run ocrtech audit-limbu-output outputs/limbu-page-run
```
Audit any automatic correction profile before using it:
```bash
uv run ocrtech audit-limbu-post-correction-profile \
path/to/limbu-post-correction-profile.json \
--out outputs/limbu-post-correction-profile-audit
```
For dry runs with sidecar OCR fixtures:
```bash
uv run ocrtech parse-limbu-doc path/to/page.png --out outputs/limbu-sidecar-smoke --engine sidecar
```
For book-shaped runs, put the page images in reading order in a JSONL manifest and run
the multi-page wrapper:
```jsonl
{"page_id":"book-p001","image_path":"pages/page-001.png","parse_kwargs":{"line_detection_mode":"image-line"}}
{"page_id":"book-p002","image_path":"pages/page-002.png","parse_kwargs":{"line_detection_mode":"image-line"}}
```
```bash
uv run python tools/parse_limbu_book_pages.py \
--page-manifest path/to/book-pages.jsonl \
--out outputs/limbu-book-run \
--engine candidate \
--model-config outputs/limbu-first-router-v1/model-card.json
```
The wrapper is intentionally thin: each page still goes through `parse-limbu-doc` /
`parse_limbu_document`, and the book layer only aggregates per-page bundles into
`book.md`, `book.body.md`, `book-review-queue.tsv`, `book-run.json`, and a
`score-documents/` projection compatible with `tools/run_page_ocr_eval.py`. Manifest
rows must provide `page_id` or `sample_id` or `id`, plus `image_path` or `source_path`;
the optional `parse_kwargs` object is restricted to known page-parser settings so a
book run cannot smuggle in unsupported behavior. Use this for multi-page digitization,
then score with frozen references before making any quality claim.
For the current Devanagari Limbu book path, add `--line-assembly` to produce the
measured source-break line-structure projection:
```bash
uv run python tools/parse_limbu_book_pages.py \
--page-manifest path/to/book-pages.jsonl \
--out outputs/limbu-book-run \
--engine candidate \
--model-config outputs/limbu-first-router-v1/model-card.json \
--line-assembly
```
This does not rewrite the audited per-page OCR bundles. It writes separate
`line-assembly-source-documents/` and `line-assembled-documents/` directories, audits
the assembled documents by replay, and points `book.md`, `book.body.md`, and
`score-documents/` at that book-level projection. It also writes
`book-line-review-queue.tsv`, which is the review sheet to use when checking assembled
book text: each row names the editable book line, whether it was assembled, the source
line ids, the source review rows that triggered review, and the assembled text with
internal newlines escaped as `\n`. Keep `book-review-queue.tsv` as the source-page
correction input for existing review-application tooling.
After editing `book-line-review-queue.tsv`, apply accepted book-line corrections to a
new editable projection:
```bash
uv run python tools/apply_limbu_book_line_reviews.py \
outputs/limbu-book-run \
--out outputs/limbu-book-run-corrected
```
Accepted rows are statuses such as `accepted`, `corrected`, `verified`, or `done` with
non-empty `corrected_text`. The tool writes corrected `book.md`, `book.body.md`,
`book-documents/`, `score-documents/`, `book-line-correction-audit.json`, and
`book-line-correction-pairs.jsonl`. It applies corrections to the assembled book-line
projection and records source line ids. For current review queues, actionable rows must
also keep valid `source_crop_paths` and `source_crop_sha256s`; stale or tampered crop
references are rejected before any corrected book projection is written. It does not try
to split an assembled-line correction back into the original page OCR fragments.
If both `book-line-review-queue.tsv` and
`layout-gap-review/layout-gap-review-queue.tsv` have been reviewed, apply both in the
correct order with one command:
```bash
uv run python tools/apply_limbu_book_review_queues.py \
outputs/limbu-book-run \
--out outputs/limbu-book-run-reviewed
```
The wrapper applies book-line corrections first, then accepted layout-gap insertions,
and writes the final reviewed projection under `final-book/`. It records the source
hashes, intermediate application reports, the final `book-run.json`, and a layout-gap
application consistency audit. It also writes a top-level `README.md` pointing at the
final editable text, final `book-run.json`, and consistency audit. This is the
preferred operator command once both review queues have been edited.
After editing `layout-gap-review/layout-gap-review-queue.tsv`, apply accepted
missed-line insertions to a new editable projection:
```bash
uv run python tools/apply_limbu_book_layout_gap_reviews.py \
outputs/limbu-book-run \
--out outputs/limbu-book-run-gap-corrected
```
Accepted layout-gap rows require an accepted/corrected/verified-style status,
non-empty `corrected_text`, and valid `crop_path` / `crop_sha256`. The applicator
inserts a new reviewed line at the gap geometry, writes chainable corrected `book.md`,
`book.body.md`, `book-documents/`, `score-documents/`, `book-run.json`, and
`layout-gap-review-application-audit.json`, and rejects stale or tampered crop hashes
before writing the corrected projection.
Audit the layout-gap application output:
```bash
uv run python tools/audit_limbu_book_layout_gap_review_application.py \
outputs/limbu-book-run-gap-corrected
```
Audit the whole book bundle after the run:
```bash
uv run python tools/audit_limbu_book_output.py outputs/limbu-book-run
```
This writes `limbu-book-output-audit.json` and `.md` for the raw OCR book bundle. It checks the book manifest,
aggregate markdown, both review queues, score-document projection, per-page output
audits, and line-assembly replay audit when assembly is enabled. It is an artifact
consistency audit, not an OCR-quality claim.
To replay already-materialized page OCR documents through the book wrapper, prepare
sidecar inputs first:
```bash
uv run python tools/prepare_limbu_book_sidecar_replay.py \
--eval-manifest path/to/eval.jsonl \
--documents-dir path/to/page-document-outputs \
--out outputs/limbu-book-replay-inputs
```
This is useful for verifying book packaging and scorer compatibility against selected
diagnostic outputs. It is not fresh OCR inference; the replay summary records the
source document hashes.
After review, apply accepted corrections back to the parsed document:
```bash
uv run ocrtech apply-limbu-review-corrections \
--document outputs/limbu-page-run/document.json \
--review-queue outputs/limbu-page-run/limbu-review-queue.tsv \
--out outputs/limbu-page-corrected
```
Freeze accepted correction pairs into deterministic train/heldout material before
deriving or admitting a profile:
```bash
uv run ocrtech build-limbu-correction-pair-pack \
outputs/limbu-page-corrected/limbu-correction-pairs.jsonl \
--out outputs/limbu-correction-pair-pack-v1 \
--pack-id limbu-corrections-v1 \
--heldout-fraction 0.20
```
Correction-pair rows are script-class constrained before they can become training or
held-out scoring substrate. Accepted review rows, pack building, pack audit, profile
derivation, and held-out scoring all reject unsupported `script_class` values outside
`limbu_sirijonga`, `devanagari_limbu`, `mixed_limbu_devanagari`, or `other`. Missing
row values are inferred from the clean text; misspelled explicit values are not
silently normalized.
Audit the frozen correction-pair pack before deriving or scoring from it:
```bash
uv run ocrtech audit-limbu-correction-pair-pack \
outputs/limbu-correction-pair-pack-v1 \
--out outputs/limbu-correction-pair-pack-v1/audit
```
The train split can seed an experimental deterministic profile:
```bash
uv run ocrtech derive-limbu-post-correction-profile \
outputs/limbu-correction-pair-pack-v1/train-limbu-correction-pairs.jsonl \
--out outputs/limbu-post-correction-profile-derived \
--profile-id limbu-derived-post-correction-profile-v1 \
--min-support 2
```
Score the profile on a separate held-out correction-pair pack before claiming
validated automatic correction:
```bash
uv run ocrtech score-limbu-post-correction-profile \
outputs/limbu-post-correction-profile-derived/limbu-post-correction-profile.json \
outputs/limbu-correction-pair-pack-v1/heldout-limbu-correction-pairs.jsonl \
--out outputs/limbu-post-correction-profile-heldout-score \
--frozen-eval-pack limbu-heldout-corrections-v1
```
If the held-out score passes, write a new admitted profile instead of editing the
profile by hand:
```bash
uv run ocrtech admit-limbu-post-correction-profile \
outputs/limbu-post-correction-profile-derived/limbu-post-correction-profile.json \
outputs/limbu-post-correction-profile-heldout-score/limbu-post-correction-profile-eval.json \
--out outputs/limbu-post-correction-profile-admission
```
Audit the corrected bundle before using its text or correction pairs:
```bash
uv run ocrtech audit-limbu-output outputs/limbu-page-corrected
```
## Required Model Shape
The intended model card is a `script_select_composite` candidate:
- primary recognizer: Devanagari-written Limbu recognizer or strong Devanagari baseline
- secondary recognizer: Sirijonga/Limbu recognizer
- `script=limbu`
- `routing_granularity=line` once both recognizers return aligned line boxes
- `routing_signal_engine=secondary`, so the Sirijonga recognizer's own U+1900..U+194F
output can trigger Sirijonga routing even when the Devanagari primary fails to emit
Limbu codepoints
- `primary_guard_script=devanagari` and `primary_guard_threshold=0.5`, so a primary
line that is clearly Devanagari is not replaced by a Sirijonga recognizer
hallucination
- `secondary_structure_backfill=true` when the secondary engine has stronger page layout
The current packaged router lives at `outputs/limbu-first-router-v1/model-card.json`.
It uses Tesseract `nep+eng` as the Devanagari primary and the exported v4 PaddleOCR
Sirijonga recognizer as the secondary. The Sirijonga backend uses
`recognition_mode=auto`: normal page images still go through PaddleOCR detection, while
wide/short line crops go straight to the lower-level PaddleOCR `TextRecognition`
recognizer. That matters because the full PaddleOCR detector failed on a real Sikkim
Herald Sirijonga line crop by detecting only a tiny blank edge strip; recognizer-only
mode emits Sirijonga Unicode for that same crop.
The v4 component was exported from
`outputs/limbu-recognizer-v4-2026-06-18/limbu-v4.tgz` and packaged at
`outputs/limbu-v4-paddle-package-2026-06-21/package/model-card.json`. The copied router
component is `outputs/limbu-first-router-v1/components/limbu-sirijonga-paddle-v4/`.
Both the component and router model-card audits pass, and the guarded runtime preflight
passes under a Python 3.11 OCR environment on this machine:
```bash
PYTHONPATH=src /tmp/ocrtech-paddle311/bin/python -m ocrtech.cli preflight-limbu-pipeline \
--model-config outputs/limbu-first-router-v1/model-card.json \
--out outputs/limbu-first-router-v1/runtime-preflight-py311-v4-guarded
PYTHONPATH=src /tmp/ocrtech-paddle311/bin/python -m ocrtech.cli parse-limbu-doc \
path/to/prepared-page.png \
--out outputs/limbu-page-run \
--engine candidate \
--model-config outputs/limbu-first-router-v1/model-card.json
```
`preflight-limbu-pipeline` records this as `limbu-runtime-preflight.json` and
`limbu-runtime-preflight.md`, including the router model-card audit, nested component
model-card audit, Python executable/version, required Python modules, Tesseract binary,
and required Tesseract language data. The repo's default `uv run` environment currently
uses Python 3.14 and still fails Paddle/PaddleOCR imports; use the Python 3.11 runtime
above for operational OCR until the project environment is moved to a Paddle-compatible
Python.
On macOS, Tesseract is installed through Homebrew. The full `tesseract-lang` package is
large; if disk is tight, installing only `nep.traineddata` beside the bundled `eng`
language data is enough for this router:
```bash
brew install tesseract
curl -L --fail -o /opt/homebrew/share/tessdata/nep.traineddata \
https://github.com/tesseract-ocr/tessdata/raw/main/nep.traineddata
```
The Python side needs the project OCR engine dependencies plus a platform-appropriate
PaddlePaddle install so that `import paddle` and `import paddleocr` both pass. Use the
preflight report as the source of truth after installation.
Current machine note: `/tmp/ocrtech-paddle311/bin/python` has been recreated with
Python 3.11.13, `paddle` 3.3.1, and `paddleocr` 3.7.0. The refreshed preflight at
`outputs/limbu-first-router-v1/runtime-preflight-2026-06-21-py311-restored-paddle`
passes the runtime dependency checks for `paddle` and `paddleocr`, but the overall
router preflight still fails because the deployed Devanagari primary is explicitly
marked failed after the CDC page diagnostic. The runtime is usable for Sirijonga
measurement; the router is not ready until the Devanagari primary is replaced or
re-admitted with evidence.
Do not call this page-level OCR best-in-class until the detector, recognizer routing, and
reading-order behavior have been evaluated on held-out page references. The existing
strong Limbu number is an oracle-crop recognizer result, not a full page OCR result.
The router model card at `outputs/limbu-first-router-v1/model-card.json` now records
component admission explicitly: `devanagari_primary` is `failed`, while
`sirijonga_secondary` remains `experimental` until full-page references are scored and
the live crop/reading-order path is improved.
## Current Real Runtime Evidence
As of 2026-06-21, the guarded v4 router has local real-asset checks and
non-claim diagnostics:
- Gorkhapatra Limbu language-page candidate, now confirmed as
Namdhinggo/Sirijonga-script material rather than Devanagari-written Limbu:
`outputs/limbu-dual-script-real-run-2026-06-21/gorkhapatra-devanagari-ocr-v4-guarded`.
Capture audit and output audit pass. The run produced 98 OCR lines, 22 review lines,
four detected tables, average line confidence 0.821, and a warning for low-confidence
lines. Routing selected Tesseract for 7 guarded Devanagari lines and PaddleOCR for 91
Sirijonga-classified lines. The output directory still carries the older
`gorkhapatra-devanagari` run name, but that is not evidence that the page is
Devanagari-written Limbu.
- Current-schema rerun of the same real Sirijonga page:
`outputs/limbu-dual-script-real-run-current-2026-06-21/gorkhapatra-sirijonga-ocr-v4-current`
was produced from a fresh `prepare-limbu-capture` bundle at
`outputs/limbu-dual-script-real-run-current-2026-06-21/gorkhapatra-sirijonga-prep`.
Capture audit passed; auto-deskew was conservatively skipped because the page had
insufficient near-horizontal line evidence. The OCR run produced 92 lines, 4 tables,
and 25 review rows, with script counts `limbu_sirijonga=79`,
`devanagari_limbu=11`, `mixed_limbu_devanagari=1`, and `other=1`.
Strict capture-plus-Sirijonga audit passed at
`strict-audit-capture-sirijonga/limbu-output-audit.json` (SHA-256
`67fe54feab8f636996de78c36cb303e60c5799bdce2fbeca082a9cd2997ce564`).
The stricter final policy audit intentionally fails with
`strict Limbu output policy requires no pending review lines: review_line_count=25`;
this output is current-format real triage evidence, not a finished digitization.
Scoring that current-schema output against a derivative current-input copy of the
non-claim Gorkhapatra draft reference at
`outputs/limbu-page-eval-drafts/gorkhapatra-limbu-sirijonga-2026-06-21/score-current-router-v4-current`
gives codepoint CER 0.823802, grapheme CER 0.859202, line detection F1 0.010127,
and 2/303 matched reference lines. The eval has no document source mismatch, but its
audit is not claim-safe: the pack is one unreviewed machine-converted page, not
frozen or claim eligible, and the train/dev leakage check has not been run.
`compare-current-router-vs-live-v4-current` shows this current-schema run is
slightly worse than the older guarded live-detector diagnostic, by -0.008158
absolute codepoint-CER and -0.001988 absolute grapheme-CER. Treat this as evidence
that the current operational path is still in the same full-page failure regime, not
as progress over the prior page output.
Replaying the best local image-line diagnostic recipe on the same fresh prepared
input gives a better but still unacceptable candidate route:
`current-image-line-box-documents-width480-wide-rtl` uses Otsu thresholding, ink
boxes, a 23x3 morphology kernel, 12 px crop padding, the width-480 Sirijonga line
recognizer, and wide right-to-left order; `auto_layout` selects that order on this
page from image features alone. The unpruned current-input score is codepoint CER
0.761144, grapheme CER 0.804042, line F1 0.833866, 261/303 matched references, and
matched-line codepoint CER 0.106076. A precision-first confidence/script filter
(`drop_empty`, confidence >= 0.85, require Sirijonga/mixed script) keeps 199/323
lines and scores better text but lower recall: codepoint CER 0.730446, grapheme CER
0.763956, line F1 0.792829, precision 1.0, recall 0.656766, and matched-line
codepoint CER 0.036114. This is the current best diagnostic path for review
triage, but it is not a full-page solution because it deliberately omits 104/303
reference lines plus other unmatched content.
The route is now wired into `parse-limbu-doc` as `--line-detection-mode image-line`.
The operational mode emits normal Limbu artifacts plus `image-line-ocr-run.json`,
`image-line-crops/manifest.jsonl`, hashed image-line crop PNGs in
`limbu-output-manifest.json`, and the usual script-aware review queue/dashboard.
It also supports repeatable operational rescue detector passes with
`--image-line-rescue-detector-pass key=value,...` and IoU dedupe via
`--image-line-merge-iou-threshold`; emitted line/crop metadata records
`detector_source_pass` and `image-line-ocr-run.json` summarizes detected, kept, and
removed rows by source pass so primary and rescue detections remain auditable.
Optional `--image-line-filter-drop-empty`, `--image-line-filter-min-confidence`,
`--image-line-filter-require-script`, and relative geometry flags such as
`--image-line-filter-min-width-ratio` expose precision-first triage modes; leave
those filters off for fuller recall. The current admitted Sirijonga triage recipe is
`--image-line-filter-drop-empty --image-line-filter-require-script sirijonga
--image-line-filter-min-confidence 0.70 --image-line-filter-min-width-ratio 0.05`.
Final audits for image-line outputs must include
`audit-limbu-output --require-no-dropped-image-lines` so filtered partial outputs
cannot pass by deleting low-confidence or short-fragment content.
Running the operational mode itself on the current prepared page produced
`outputs/limbu-operational-image-line-current-2026-06-21/gorkhapatra-width480-unpruned`
with 323 kept image-line OCR lines, 0 dropped detected lines, 1 empty crop, 96
review rows, and script counts `limbu_sirijonga=293`, `other=30`. Its
capture/Sirijonga/no-dropped strict audit passes (SHA-256
`ec5e62a13be875a86f16cb1725f7cbf586153adbc243d1df1adc3ede2a121300`), but final
strict policy still fails with `review_line_count=96`. Scoring the operational
bundle gives the same non-claim diagnostic metrics as the materializer route:
codepoint CER 0.761144, grapheme CER 0.804042, line F1 0.833866, 261/303 matched
references, and +0.062658 absolute codepoint-CER improvement over the current router.
The operational precision-first run at
`outputs/limbu-operational-image-line-current-2026-06-21/gorkhapatra-width480-prune-conf085`
keeps 199/323 lines, removes 124, and has zero review rows. The previous strict
final-policy pass without a dropped-line gate is superseded: `audit-limbu-output
--require-no-dropped-image-lines` now rejects this bundle with
`removed_line_count=124` (SHA-256
`a7527a6fe61c23bc37598ade9f8a8d9429b188a1616398e3f76c4f3639735fa4`). It remains a
high-precision partial-output bundle. Its draft score is codepoint CER 0.730446,
grapheme CER 0.763956, line F1 0.792829, precision 1.0, recall 0.656766, and
+0.093356 absolute codepoint-CER improvement over the current router; do not treat
the zero review queue as page completeness.
The refreshed operational line-failure analysis at
`outputs/limbu-page-eval-drafts/gorkhapatra-limbu-sirijonga-2026-06-21/line-failure-analysis-operational-width480-minwidth005-conf070-v4`
makes the remaining detector miss pattern explicit: 67 references are unmatched, only
2 high-IoU matches are bad-text rows, and 2,422/2,888 attributed codepoint errors are
missed reference text. The miss concentration is horizontal, not simply top/bottom:
center-band references are unmatched at 42/106 with 1,757 missed-reference
codepoints, while left is 9/97 and right is 16/100. The worst combined bands are
middle/center (20/42, error mass 810), bottom/center (14/45, error mass 664), and
top/center (8/19, error mass 283). The v4 overlap diagnostic shows this is not
primarily matched-line swallowing: 65/67 unmatched references have no overlapping
prediction at all and only 2/67 reach IoU >= 0.30 against any predicted box. Next
detector work should target no-component center-column body-line recall and false-line
handling before another confidence-only prune.
- Gorkhapatra Limbu Sirijonga page draft eval:
`outputs/limbu-page-eval-drafts/gorkhapatra-limbu-sirijonga-2026-06-21`.
The accepted page `gorkhapatra-language-page-0001-01` has a PDF-native draft
reference generated from `NamdhinggoSILL` spans with the `limbu-namdhinggo`
converter. It has 303 reference lines, 36 spans with unmapped conversion issues, and
remains explicitly non-claim (`gt_status=machine_converted_unreviewed`,
`claim_evidence_eligible=false`). Scoring the existing guarded live-detector OCR
output as `--ocr-output-kind live_detector` gives codepoint CER 0.815643, grapheme
CER 0.857214, line detection F1 0.009975, and only 2 matched lines out of 303
references. The eval audit passes artifact consistency, but the run is not
claim-safe because the pack is one page, not frozen, and not human verified. The
oracle-line-box diagnostic at
`outputs/limbu-page-eval-drafts/gorkhapatra-limbu-sirijonga-2026-06-21/score-oracle-line-boxes-v4`
forces the same v4 recognizer over all 303 reference boxes and scores at codepoint
CER 0.029268, grapheme CER 0.060792, matched-line codepoint CER 0.030031,
matched-line grapheme CER 0.063993, and line F1 1.0. The paired comparison
`compare-oracle-vs-live-v4` shows a non-claim-safe codepoint-CER improvement of
0.786375, so this page is overwhelmingly a live detection/segmentation failure when
the boxes are oracle-quality, not a same-font Sirijonga recognizer failure.
A tuned morphology detector diagnostic at
`outputs/limbu-page-eval-drafts/gorkhapatra-limbu-sirijonga-2026-06-21/image-line-box-documents-v4-tuned`
uses `tools/materialize_page_image_line_boxes.py` with Otsu thresholding, ink bboxes,
horizontal kernel 23, vertical kernel 3, max line height 140, 2 px detector padding,
and 12 px crop padding. It emits 323 lines, matches 261/303 references, and improves
geometry to line F1 0.833866 with mean IoU 0.879406, but page text remains poor:
codepoint CER 0.763835, grapheme CER 0.828226, matched-line codepoint CER 0.285785,
matched-line grapheme CER 0.551916, and matched-line reading-order pair accuracy
0.606543 over 33,930 aligned-line pairs. The older raw `reading_order_pair_accuracy`
remains 0.0 for this live detector because predicted IDs are `img-line-*` while
reference IDs are `span-*`; use the matched-line reading-order metric for live
detector diagnostics. Treat this as a useful detector prototype, not a solved page
OCR path. A detector-only reading-order comparison at
`outputs/limbu-page-eval-drafts/gorkhapatra-limbu-sirijonga-2026-06-21/compare-detector-reading-order-column-major-v1`
used `tools/compare_limbu_sirijonga_detector_reading_order.py` to compare
`top_to_bottom` with `column_major` under the same tuned detector parameters; both
modes score matched-line reading-order pair accuracy 0.606543, so the simple
column-major switch is not a rescue. A detector-only parameter sweep at
`outputs/limbu-page-eval-drafts/gorkhapatra-limbu-sirijonga-2026-06-21/detector-param-sweep-v1`
evaluated 1,680 morphology configs and found a small geometry improvement by keeping
the 23x3 kernel but lowering `max_height` to 80: line F1 0.844660, precision
0.828571, recall 0.861386, 315 predicted lines, and the same 261/303 matches. This
candidate can be approximated by filtering the already materialized tuned OCR
document because the 315 candidate boxes are a strict subset of the prior 323 boxes.
`outputs/limbu-page-eval-drafts/gorkhapatra-limbu-sirijonga-2026-06-21/score-image-line-detector-v4-tuned-maxheight80-filtered`
shows that reuse-filtered candidate does not improve page text: codepoint CER remains
0.763835 and grapheme CER moves slightly worse from 0.828226 to 0.828392. It still
leaves matched-line reading-order accuracy at 0.606543. A line-failure analysis at
`outputs/limbu-page-eval-drafts/gorkhapatra-limbu-sirijonga-2026-06-21/line-failure-analysis-image-line-detector-v4-tuned`
joins line alignment with crop provenance and shows the dominant failure: 138/261
matched lines are high-IoU (>=0.85) but bad-text, versus only 11 low-geometry
bad-text matches. Those high-IoU bad-text rows have mean IoU 0.893282, mean confidence
0.445911, mean codepoint reference length 45.17, mean crop width 330.88 px, mean
crop aspect ratio 6.73, and mean grapheme CER 0.678634. The matched crop-width bands
degrade from <=256 px codepoint CER 0.132605 / confidence 0.805627 to 769+ px
codepoint CER 0.412653 / confidence 0.219722. The immediate next Sirijonga OCR
artifact is the recognizer input-width ablation pack at
`outputs/limbu-page-eval-drafts/gorkhapatra-limbu-sirijonga-2026-06-21/recognizer-width-ablation-v1`,
with 233 high-IoU matched crops and PaddleOCR line-recognition model-card variants
for input widths 320, 480, 640, 960, and 1280. The restored Python 3.11 Paddle
runtime scored all five variants with zero prediction failures. Width 480 is the
winner on this diagnostic pack: codepoint CER 0.100651, grapheme CER 0.169567, and
exact line accuracy 0.278970. Width 320 is much worse (codepoint CER 0.269910), and
larger widths regress: width 640 codepoint CER 0.108741, width 960 codepoint CER
0.212755, and width 1280 codepoint CER 0.442740. Testing the same tuned page
materialization with the width-480 model card improves matched-line codepoint CER
from 0.285785 to 0.105977 and matched-line grapheme CER from 0.551916 to 0.178678,
but it does not improve full-page text: page codepoint CER moves from 0.763835 to
0.770900 while matched-line reading-order accuracy remains 0.606543. Treat width
480 as the right Sirijonga line-recognition setting, but not a page-OCR fix by
itself. A layout-specific `wide_column_right_to_left` ordering diagnostic improves
Gorkhapatra matched-line reading-order pair accuracy from 0.606543 to 0.763985 with
the same 261/303 matches and line F1 0.833866, but the same mode regresses the
Sikkim draft from 0.992402 to 0.753361, so it cannot be a global Sirijonga default.
`tools/materialize_page_image_line_boxes.py` now also exposes `--reading-order
auto_layout`, which records requested and selected ordering plus layout features.
The current heuristic selects `wide_column_right_to_left` only for wide pages with
column-like regular line widths. On the same detector-only comparisons it matches
the Gorkhapatra wide-RTL ordering gain (0.606543 -> 0.763985, result SHA-256
`9025a7fa5141f970425c22cfd20e29ebb78edadca60b6c6eec2bee0813541204`) while keeping
Sikkim at `top_to_bottom` with zero ordering delta (0.992402 -> 0.992402, result
SHA-256 `a28dff4c45be44d68916bd7df4f2961df74ac079c35e16b885bd5649eb886c12`).
This is a layout-selection diagnostic, not a recognition improvement by itself.
Scoring Gorkhapatra with width 480 plus this wide right-to-left order improves
full-page codepoint CER from 0.770900 to 0.761228 and grapheme CER from 0.804207 to
0.803876, while matched-line codepoint CER remains 0.105977. This is useful signal,
not a solved page OCR path: the paired sample count is 1, the run is not claim-safe,
and the page is still dominated by false predictions, unmatched references, and
assembly errors. `tools/analyze_page_line_failures.py` now has an unmatched-line
diagnostic that writes `top-unmatched-references.csv`,
`top-unmatched-predictions.csv`, and `near-miss-unmatched-pairs.csv`. On the
current operational width-480 unpruned run,
`outputs/limbu-page-eval-drafts/gorkhapatra-limbu-sirijonga-2026-06-21/line-failure-analysis-operational-width480-unpruned-v4`
reports 261 matched rows, 42 unmatched references, 62 unmatched predictions, and
only 15 high-IoU bad-text matches. The remaining missed references are not mostly
easy threshold near misses: only 5/42 have an unmatched prediction with IoU >= 0.30
and 0/42 have IoU >= 0.50. The v4 analyzer now reports attributed codepoint error
mass, spatial missed-reference bands, best-overlap against every predicted box, and
operational image-line crop manifests that have line ids but no `sample_id`. On the
unpruned route, `missed_reference_text` remains dominant at 1,416/2,919 attributed
codepoints (0.485), and the center band accounts for 31/106 unmatched references plus
1,116 missed codepoints. Only 5/42 unmatched references reach IoU >= 0.30 against any
predicted box and none reach 0.50; 28/42 have no overlapping prediction at all. The
result JSON SHA-256 is
`f540fe59bf23b4f9b81c67b8e21f6827a563336d999781132ca4a2b23732c4a0`, and the report
SHA-256 is `a51ddce081e8d0989ce13bbaa90a575aa4887a5e69a2b70c0745f8d7d0c7b467`.
On the current `minwidth005-conf070` operational route, the refreshed analysis at
`line-failure-analysis-operational-width480-minwidth005-conf070-v4` reports 236
matched rows, 67 unmatched references, 2 unmatched predictions, only 2 high-IoU
bad-text matches, and dominant error source `missed_reference_text`: 2,422/2,888
attributed codepoints (0.839). Its spatial bands show center horizontal coverage is
the main miss source: 42/106 center references are unmatched with 1,757 missed
codepoints, and the worst combined bands are middle/center, bottom/center, and
top/center. Result SHA-256:
`1da537b596b8c6e2b010998fc183289a8e632c75237d509c783b3977ba9e1c65`; report
SHA-256: `d9fef331d97b94877f39b02b8ddf29445d97e96d44cfcaf16e93f6b15ba993ba`.
This moves the next fix away from simply lowering match thresholds or splitting
matched detections. Direct pixel inspection of the largest center-column misses shows
the text is visible in the prepared image, but those rows fall inside one rejected
Otsu/morphology connected component at `[995,401,326,1404]`; the detector was
discarding a tall merged body component, not failing because ink was absent.
A bounded adaptive-threshold branch was tested and rejected: `adaptive_mean:41:11`
under the operational 23x3 settings raised matches from 261 to 263 but only reached
F1 0.844302, and adaptive rescue on the `max_height=80` tuned route lowered F1 below
the no-rescue 0.844660 baseline.
The admitted detector-only recall fix is now tall-component splitting.
`src/ocrtech/image_lines.py`, `tools/materialize_page_image_line_boxes.py`, and
`tools/compare_limbu_sirijonga_detector_reading_order.py` expose opt-in
`split_tall_components` / `--split-tall-components`, row-projection settings
`split_tall_row_min_ink=2` and `split_tall_max_row_gap=4`, and provenance
`detector_source_pass=primary-split-tall`. On Gorkhapatra, the reproducible
detector-only run at
`outputs/limbu-page-eval-drafts/gorkhapatra-limbu-sirijonga-2026-06-21/compare-detector-split-tall-maxh80-v1`
uses Otsu, ink boxes, 23x3 morphology, `max_height=80`, detector padding 2, and
tall splitting; it reaches 285/303 matches, 339 predictions, precision 0.840708,
recall 0.940594, F1 0.887850, mean IoU 0.869405, and wide-RTL matched reading-order
pair accuracy 0.712824. Result SHA-256:
`06c242545dce5462dcfb25773b71045c1c3cde026843751d62d2c3a7f44a07c3`; report SHA-256:
`f9dd7e679f733937a5b793e45e38eb02394c8b3fb80fc3f8eb039b3ac770e82c`;
alignment TSV SHA-256:
`44feb8ba76840f85b008c0a1c773b3a033d1b11637e3f002ceebcdab23ae7414`.
Full OCR materialization has now been run and rejects split-tall as an admitted page
route by itself. `image-line-box-documents-v4-split-tall-width480-wide-rtl` was
materialized with the v4 width-480 line recognizer, `recognition_mode=line`, 339
lines, and 0 empty predictions. Run SHA-256:
`80808cefbc3804b0385a6c2a2fe16522ebe1a7c307b9447210006905d1712c96`; crop manifest
SHA-256: `7e6b62b25ef17687897034ed70eb1bf09c3d50a407d8a786707825cbd4a99cc5`;
document SHA-256:
`da1a1664aee6beb1381ed338f884033c44e5c3a17d9bc9b610f86f778b97563b`. Scoring at
`score-image-line-detector-v4-split-tall-width480-wide-rtl` gives page codepoint CER
0.791421 and grapheme CER 0.831042, worse than the non-split wide-RTL score
0.761228 / 0.803876. Metrics SHA-256:
`db52ef81012890dbe77179b9deadb72adb04f90c9228cffd2b68860ae5902b18`; run SHA-256:
`33977edad6ff145a24891ecfda9b990f0895074c5043ef902a4ba46f92c8e990`.
The paired comparison at
`compare-split-tall-width480-wide-rtl-vs-tuned-width480-wide-rtl` reports negative
absolute improvement: codepoint -0.030193, grapheme -0.027166; comparison SHA-256
`86906240daae771ba960cbd725b19210bde3eb08d4a2d3c4d95e37ca9610835e`.
The failure shape changed: `line-failure-analysis-split-tall-width480-wide-rtl-v1`
shows 285 matches, 18 unmatched references, 54 unmatched predictions, and
`missed_reference_text` error mass down to 425, but page assembly is now dominated by
matched bad text/extra prediction text and worse reading order (0.712824 versus the
previous wide-RTL 0.763985). Analysis SHA-256:
`b3d8266031538bce0c63f38f6db4e2f485ac2e18fe26f9fcda4bc3408f05524d`; report
SHA-256 `eef5b226a0f60f203501a6c0c2ab48166fd5e159bf91f559df70a4f5c79a64e0`.
Pruning without fixing order does not rescue split-tall enough: `ocr-line-pruning-sweep-split-tall-width480-wide-rtl-v1`
has best threshold 0.85 with codepoint CER 0.740875 and grapheme CER 0.768759
(sweep SHA-256 `085765fe1264ec1b45e879cf2677539eb1436f208a5a2e6a01e9b88cea1d1e5f`),
still worse than the older non-split Gorkhapatra-only conf085 result 0.730362 /
0.763956. The clean comparison at
`compare-split-tall-conf085-vs-tuned-width480-wide-rtl-conf085` gives codepoint
improvement -0.010513 and grapheme -0.004804 (comparison SHA-256
`4cc4b640ca0ab5e1c6beaac2badeae0f1acf1378674b3c4ccc9a8d67eda92068`).
A source-pass-aware ordering mode was added:
`wide_column_right_to_left_split_tall_last`. It keeps the existing wide-RTL order for
primary boxes and places `*-split-tall` boxes after primary boxes. Detector-only
comparison at `compare-detector-split-tall-wide-rtl-last-v1` improves split-tall
matched-line reading-order accuracy from 0.712824 to 0.765654 with the same 285/303
matches and F1 0.887850; comparison SHA-256:
`cce99e017e0e3565c50e56d8886588910d567e94685d8f302e703f155347c636`.
Full OCR at `image-line-box-documents-v4-split-tall-width480-wide-rtl-last` scores
codepoint CER 0.778638 and grapheme CER 0.820938, better than plain split-tall but
still worse than non-split wide-RTL before pruning. With the same non-oracle
confidence sweep, `ocr-line-pruning-sweep-split-tall-wide-rtl-last-v1` reaches best
conf085 codepoint CER 0.730614 and grapheme CER 0.763624 (sweep SHA-256
`869381446576317d8258f36557bec4e7da0171e3f613ada59f4c8e44a9b3ca6f`). Against the
previous non-split conf085 Gorkhapatra result, the clean comparison at
`compare-split-tall-wide-rtl-last-conf085-vs-tuned-width480-wide-rtl-conf085` is a
near-tie: codepoint -0.000252, grapheme +0.000331; comparison SHA-256
`cfbb25555feab3af1d4863f4f654efd11b94bb18dde047b0b9d2890a330a71f9`. Sikkim
cross-page detector validation rejects global admission. Without tall splitting,
`compare-detector-split-last-no-split-v1` keeps Sikkim at 59/86 matches and F1
0.559242, but drops matched-line reading-order accuracy from 0.992402 to 0.753361
(comparison JSON SHA-256
`014bdc6c9fd08d7f82b8292cdcfe0e0a6a08dd2a2a6a6e3a79024e51d7acc813`). With
`--split-tall-components`, `compare-detector-split-tall-last-v1` adds one prediction
without adding matches, lowering F1 to 0.556604 while preserving the same order
regression to 0.753361 (comparison JSON SHA-256
`77d2bd30cfc2ed0a2827704c0bf21b51ec3698af3aedb1cc3459382530a9b6fc`). Full OCR
materialization is intentionally skipped for Sikkim because the detector-only gate
already fails. Keep `wide_column_right_to_left_split_tall_last` as a
Gorkhapatra/layout-specific diagnostic, not as a global Sirijonga route.
The safe follow-up is now implemented as `auto_layout_split_tall_last`: it first
detects without tall splitting, uses the existing auto-layout gate, and only reruns
tall splitting plus split-last ordering when the page qualifies as a wide-column
layout. Detector-only Gorkhapatra validation at
`compare-detector-auto-layout-split-tall-last-v1` keeps 285/303 matches, F1
0.887850, and improves matched-line reading-order accuracy from 0.712824 to
0.765654 (comparison JSON SHA-256
`6364dd87e617b3b76236ea37d71b08fab216d5c5ffb8a3b08d6b03560581237b`). Sikkim
validation at `compare-detector-auto-layout-split-tall-last-v1` selects
top-to-bottom, keeps 59/86 matches, improves F1 back to 0.559242 by avoiding the
split false-positive, and preserves matched-line reading-order accuracy at 0.992402
(comparison JSON SHA-256
`5aa325d176af4a85dda65a3e3684ae9c80bc7c9a7485e0cb7e0729f8fddf20e7`). Full OCR
materialization confirms the route behavior: Gorkhapatra emits 339 lines with
`wide_column_right_to_left_split_tall_last`, scores codepoint CER 0.778638 /
grapheme CER 0.820938, and exactly matches the explicit split-last OCR score
(`compare-auto-split-tall-vs-split-tall-wide-rtl-last` JSON SHA-256
`9326ef4b2e33964d985c734b34ba824977658887ee3ee6f61f7ab8cb724c3b61`); Sikkim emits
125 primary lines with `top_to_bottom`, scores codepoint CER 0.460255 / grapheme CER
0.576710, and exactly matches the existing image-line baseline
(`compare-auto-split-tall-vs-image-line-v4` JSON SHA-256
`50b845f80d1212eb2c751ba43070880602c70c506f6682e9f8e1ca0266802e7e`). This is a
safer candidate branch, not an admitted final policy: the Gorkhapatra unpruned page
score is still worse than the non-split wide-RTL score, and claim safety remains
blocked by draft machine-converted one-page references.
Running the gated branch through the same non-oracle pruning/admission layer confirms
that boundary. `ocr-line-pruning-sweep-auto-split-tall-minwidth005-v1` reaches a
Gorkhapatra local best at conf085, codepoint CER 0.730614 / grapheme CER 0.763624,
but Sikkim regresses badly at conf085 to codepoint CER 0.702650 / grapheme CER
0.731978. Cross-page admission at
`outputs/limbu-sirijonga-auto-split-tall-pruning-threshold-admission-2026-06-21`
therefore selects conf070, with Gorkhapatra codepoint CER 0.753406 / grapheme CER
0.782508 and Sikkim codepoint CER 0.423454 / grapheme CER 0.511091; admission JSON
SHA-256 is `2bc16296a6295a03482ef30a01729c5ae7b37278c6623ca38d6431d86a3665ed`.
Direct comparison against the already-admitted non-split minwidth005 conf070 route
rejects promotion: Sikkim is tied exactly, but Gorkhapatra regresses by 0.014045
codepoint CER and 0.014245 grapheme CER
(`compare-auto-split-tall-minwidth005-conf070-vs-non-split-minwidth005-conf070`
JSON SHA-256 `f26b0911a4ba92bce47ea53bee0af6f88a5ef93f61f6361586daacd74d814b70`).
Keep auto-split-tall as a diagnostic/alternative for recall analysis, not the
admitted operational pruning route.
The operational `parse-limbu-doc` path now has the same rescue-pass family for real
OCR runs; `tools/materialize_page_image_line_boxes.py` and
`tools/compare_limbu_sirijonga_detector_reading_order.py` now support repeatable
`--rescue-detector-pass` morphology passes with IoU-based merge dedupe and recorded
`detector_source_pass` provenance. This creates an auditable way to test multi-pass
coverage before running recognition. On the same Gorkhapatra page, the broad
rescue passes are not good enough: `h15,v1,min_width=20` raises matches from 261 to
281 and recall from 0.861386 to 0.927393, but explodes predictions to 702 and drops
F1 to 0.559204. The best conservative tested pass
`h41,v1,min_width=250,min_area=250,max_height=80,merge_iou=0.30` reaches 264 matches
and recall 0.871287, but still lowers precision to 0.774194, F1 to 0.819876, and
matched reading-order accuracy to 0.756596 versus the no-rescue baseline F1
0.833866 / order 0.763985. Its comparison JSON SHA-256 is
`088fdca2fe6865f66998bdd10a41908240232a271ce5567a62a4528e7c02c431`. Treat this
rescue-pass support as an experiment harness, not an admitted detector improvement.
The same harness now supports `min_aspect_ratio`/`max_aspect_ratio` gates for both
primary and rescue detector passes. Aspect-gating the conservative rescue pass at
`min_aspect_ratio=8` does not admit it: the best aspect-gated result still has 341
predictions, 264 matches, precision 0.774194, recall 0.871287, F1 0.819876, and
matched reading-order accuracy 0.756596, below the no-rescue baseline. Its comparison
JSON SHA-256 is
`75934afe974a8189b97b18f61c82dde1d5d87bdbf9a540c93c6ae4aac0f75156`.
`tools/filter_page_ocr_documents.py` now adds a non-oracle OCR-line
pruning diagnostic that can drop live lines by empty text, confidence, target script,
and geometry while preserving page-eval document compatibility and writing
line-level removal reasons. `tools/sweep_page_ocr_line_pruning.py` wraps that filter
with page eval and paired comparison so threshold admission is measured, not copied
from a single page. `tools/audit_page_ocr_line_filter.py` replays the filter from the
source OCR documents and verifies filtered `document.json` files, line reports,
source hashes, and kept/removed counts; current pruning sweeps run this audit for
every threshold candidate. On Gorkhapatra width-480 wide-RTL output, the automated sweep at
`outputs/limbu-page-eval-drafts/gorkhapatra-limbu-sirijonga-2026-06-21/ocr-line-pruning-sweep-width480-wide-rtl-v1`
confirms pruning empty/non-Sirijonga lines plus confidence thresholds improves page
codepoint CER: 0.50 -> 0.746678, 0.60 -> 0.744996, 0.70 -> 0.739697, 0.80 ->
0.738436, 0.85 -> 0.730362, then 0.90 regresses to 0.760387. The best tested
Gorkhapatra candidate keeps 199/323 live lines and improves over unpruned wide-RTL
page CER 0.761228 by 0.030866 absolute, but remains one-page, draft-reference,
non-claim evidence; its standalone filter audit passes with 0 issues
(`561aae44bf6bc7e5cb5924e969d9eb8d8c41fcfcbcc5958b2888ab6390242258`). The Sikkim sweep at
`outputs/limbu-page-eval-drafts/sikkim-sirijonga-2020-12-03-page1-v1/ocr-line-pruning-sweep-image-line-v4-v1`
is the counterexample: 0.85 pruning hurts codepoint CER from 0.460255 to 0.694308,
while milder 0.70 pruning keeps 107/125 lines and improves codepoint CER to 0.444063.
Its standalone filter audit also passes with 0 issues
(`581dd1d3c0e07a6210f3fe940efa70fe8e0b998095733c60c57b038b1602f9b4`).
`tools/admit_page_ocr_line_pruning_threshold.py` now performs cross-page operational
threshold admission from these per-page sweeps instead of copying the best
single-page threshold, and the report records each admitted page's exact documents,
score, comparison, and audit hashes. The current admission run at
`outputs/limbu-sirijonga-pruning-threshold-admission-2026-06-21` requires common
thresholds across Gorkhapatra and Sikkim, passing filter audits, and no page-level
codepoint/grapheme regression. It selects `conf070`: Gorkhapatra improves codepoint
CER by 0.021531 and Sikkim improves by 0.016192. It explicitly rejects `conf085`
because Sikkim regresses by -0.234053 codepoint CER and -0.148799 grapheme CER.
Admission JSON SHA-256 is
`cc8b0b8986c273bafbc73fc74ffc706dd28eeb93343c921aa4572411aae06429`; Markdown
SHA-256 is `9e8672e71d58ae501ddd7024acf34a074ead09b12627cf81f1bff6e3b398b6e5`.
`tools/audit_admitted_page_ocr_candidate.py` now audits the admitted candidate's
residual line-alignment failures. The current `conf070` audit at
`outputs/limbu-sirijonga-conf070-residual-audit-2026-06-21` reports 296 matched
lines, 93 unmatched references, 51 unmatched predictions, 13 unmatched-reference
near misses at IoU >= 0.30, 0 high-IoU unmatched references at IoU >= 0.50, and 26
matched high-text-error rows. Gorkhapatra is now mostly a recall problem
(238 matched, 65 references missed, only 2 prediction-only lines; precision
0.991667). Sikkim remains both recall and false-line dominated (58 matched, 28
references missed, 49 prediction-only lines; precision 0.542056). The audit now
also buckets residual geometry. Gorkhapatra missed references are mostly short
boxes (51/65) concentrated in center and bottom/middle zones; Sikkim misses are
mostly medium-width lines (22/28), with bottom-zone misses (13/28), while its
prediction-only errors are overwhelmingly short boxes (47/49). The refreshed
residual audit now also replays the admitted per-page score/comparison/filter
artifact hashes and reports `artifact_integrity_passed=true`. Residual audit JSON
SHA-256 is
`28b0edcb15eaf4a3860e2560872ecd419ad5226f88964bf04feaa58104149f64`; Markdown
SHA-256 is `178ce581a9829294da482916880ce9a19df0e103a4f272a4b7b7e11ab44e2516`.
This is operational, non-claim threshold evidence only; the next page-level work is
detector/layout recall for Gorkhapatra short/body misses and Sikkim-specific false-line
handling around the stronger 480-wide line recognizer, not morphology-only tuning or
a hard-coded ordering/pruning rule.
A follow-up relative-geometry pruning sweep now extends
`tools/filter_page_ocr_documents.py` and `tools/sweep_page_ocr_line_pruning.py` with
page-relative width/height ratio filters that are replay-audited by
`tools/audit_page_ocr_line_filter.py`. The real sweep uses `min_width_ratio=0.05`,
`drop_empty`, Sirijonga script filtering, and confidence thresholds `0,0.50,0.70`.
The cross-page admission at
`outputs/limbu-sirijonga-pruning-threshold-admission-minwidth005-2026-06-21` selects
`conf070` again, with mean codepoint-CER improvement 0.029334 and worst-page
improvement 0.021867. It improves Gorkhapatra to codepoint CER 0.739361
(238/323 kept) and Sikkim to 0.423454 (82/125 kept). Admission JSON SHA-256 is
`808a2e08fd853fbc1c612b398e37fe4903808a141a642b82d3338a3f64e632e4`; Markdown
SHA-256 is `09d9d2296f72499c57156b7b4aaca89a13cbcbece82c3a800e53e74d8e247851`.
The residual audit at
`outputs/limbu-sirijonga-conf070-minwidth005-residual-audit-2026-06-21` shows why
this is still only a triage candidate: total prediction-only rows drop from 51 to
28, and Sikkim prediction precision rises to 0.682927, but total missed references
rise from 93 to 97 and Sikkim recall drops to 0.651163. Residual JSON SHA-256 is
`969868c2eac5decc1a2a4a82848f0c051adbd04c5092d7d010b31698b818e2f5`; Markdown
SHA-256 is `7ca5de60bd49d959a0f14ef96a56228400b42e46b9c0071dc78b8a497c7226d4`.
Use this relative-width candidate for precision-oriented review triage, not as a
complete page OCR policy.
A same-row component merge diagnostic now adds an opt-in detector stage that merges
horizontally adjacent fragments only when same-row, gap, center-delta, and maximum
merged-width gates pass. It is wired through `parse-limbu-doc`,
`tools/materialize_page_image_line_boxes.py`, and
`tools/compare_limbu_sirijonga_detector_reading_order.py` as
`merge_same_row_components=false` by default. With `y_tolerance=8`,
`max_gap=120`, `max_center_delta=300`, and `max_width=420`, detector-only F1
improves Sikkim from 0.559242 to 0.875000 (90 predictions, 77/86 matches; JSON
SHA-256 `379960a430a943e6076499eff5a744e084f736134a2e0579ad900e97e9dd7aa8`)
and Gorkhapatra from 0.833866 to 0.875000 (289 predictions, 259/303 matches; JSON
SHA-256 `1b2fdcdb08375ac5896487b66711787e5c59a7566dc88b60fe6e396ca2903421`).
OCR scoring shows the trap: unpruned same-row merge improves Sikkim codepoint CER
from 0.460255 to 0.418057, but Gorkhapatra remains worse than the admitted
operational route. Running the same `drop_empty`, `require_script=sirijonga`,
`min_width_ratio=0.05` confidence sweep selects `conf070` across pages at
`outputs/limbu-sirijonga-same-row-merge-pruning-threshold-admission-2026-06-21`
(admission JSON SHA-256
`970a1ad210423d430687d1666f190aa1c4795f516e9998bc4c544a086e45d32f`; Markdown
SHA-256 `2cbad5bea8d40ca4a4b49690b705838b306cebe93ac09135887fd0f39ca57c7b`).
The selected row-merge `conf070` improves Sikkim versus the already-admitted
minwidth005 `conf070` route (codepoint CER 0.412169 vs 0.423454; comparison JSON
SHA-256 `c4a5f5a2c24f92c678b91098d31b2874546d21fd79347368bc0e5862ebb4c079`),
but regresses Gorkhapatra (0.744239 vs 0.739361; comparison JSON SHA-256
`bf8902a27aadc731452990b010be60b125b4fc6cf842f287f8faaeb5aa597aaf`). Do not
globally promote same-row merge. Treat it as a conditional top-to-bottom fragmented
page repair candidate; wide-column pages still use the existing non-merge
operational path until a measured layout gate proves otherwise.
That measured gate now exists as
`merge_same_row_auto_fragmented_top_to_bottom`: it first resolves layout on
unmerged boxes, only considers `top_to_bottom` pages, and requires at least 8 boxes
and 18% line-count reduction from same-row merging before applying the repair. With
this gate, Sikkim keeps the 90-line merged detector result and matched reading-order
accuracy 0.990089, while Gorkhapatra stays on the 323-line non-merge wide-column
path. Detector comparison JSON SHA-256s are
`f5a50caaac7ee1eaea2bac4b39917cdb04e5ce8c1c622b620e9dad63e8e5b1f1`
for Sikkim and `da5d57bb77fd1eb2b1f29a69f8b491623631d24e9a8dfccd06a1e7491cbd0d21`
for Gorkhapatra. The gated OCR/pruning admission at
`outputs/limbu-sirijonga-auto-same-row-merge-pruning-threshold-admission-2026-06-21`
selects `conf070` (JSON SHA-256
`2784674a4b8ff7382086a9d1c544c25729df5f938a792b21b67d81298c9bfeed`;
Markdown SHA-256 `81894b8ee2ea515f97523baa42217ba4ca4fe0f7ad0e67610b78daba33e3835c`).
Against the previously admitted minwidth005 `conf070` route, the gated candidate
improves Sikkim codepoint CER from 0.423454 to 0.412169 and grapheme CER from
0.511091 to 0.505545, while tying Gorkhapatra at 0.739361 / 0.768262. This is now
the stronger operational candidate for the two draft Sirijonga pages, still bounded
by the same non-claim limitations: draft references, two pages, and no native-reader
adjudication.
The same recipe has now been run through the live `parse-limbu-doc` path on the
current Gorkhapatra prepared page at
`outputs/limbu-operational-image-line-current-2026-06-21/gorkhapatra-width480-minwidth005-conf070`.
It detects 323 image lines, keeps 238, removes 85, and leaves 39 review rows.
The capture/Sirijonga audit passes (`e6a97c5949e81cc0194b296e9cb44a9886536229c35b7aa41cd6156421201541`),
but strict final policy with `--require-no-dropped-image-lines` fails
(`cf07d072c55c5ab282c9ed3dd9d54dc61e47c931689e4ba029d162dab51762ef`) because
review rows and dropped image-line rows remain. Scoring that exact operational
output against the one-page Gorkhapatra draft eval gives codepoint CER 0.739361 and
grapheme CER 0.768262 at
`outputs/limbu-page-eval-drafts/gorkhapatra-limbu-sirijonga-2026-06-21/score-operational-image-line-width480-minwidth005-conf070`;
metrics JSON SHA-256 is
`14d0da1bf80e5afb876adfa6191501f2f18039dc86014123d7cf0d64551c4176` and eval audit
JSON SHA-256 is `37c6d0e0efb74d3c61b7a5bd9f3ce5bf4caf0487d47d96ba1f42e7aabfb8b6a9`.
The eval audit now passes structurally but is intentionally not claim-safe: the pack
is unfrozen, machine-converted/unreviewed, one page only, and leakage checking against
`recognizer-width-ablation-v1/manifest.jsonl` records 233 checked rows with
`source_sample_id` overlap on `gorkhapatra-limbu-sirijonga-0001-01`.
- Sirijonga geometry review now has a non-native-reader path:
`tools/prepare_line_box_review_packet.py` builds a geometry-only line-box packet
from page eval manifests and reference-seeded boxes, and
`tools/audit_line_box_review_packet.py` audits hashes, image dimensions, bbox
bounds, unique IDs, valid review statuses, and contiguous reading-order indexes.
`tools/apply_line_box_review_packet.py` is the ingestion gate for completed
geometry review: it refuses `pending` rows by default, applies accepted/corrected
boxes, drops deleted boxes, and writes detector/layout references with empty
`text` plus `claim_evidence_eligible=false`.
The current packet at
`outputs/limbu-sirijonga-line-box-review-packet-2026-06-21` covers the two real
Sirijonga draft pages: Gorkhapatra plus Sikkim, 389 seeded line boxes total
(303 + 86), `audit_passed=true`, and 0 issues. It intentionally contains no
reference transcription, so it can calibrate layout/reading-order review without a
native reader. Applying it currently blocks because all 389 rows are still
`pending`. This does not certify text ground truth; it only makes detector and
layout work reviewable.
- Devanagari-written Limbu smoke page draft:
`outputs/limbu-page-eval-drafts/limbu-devanagari-smoke-page-2026-06-21`.
This uses real local Devanagari Limbu text from
`data/synthesis-text/cdjk-rai-limbu-2026-06-16/toolkit-parallel-text.jsonl`
(`bible_brain/LIFWBT_Limbu` rows), but it is a synthetic rendered page, not a
real page capture. The pack has 1 page, 14 rendered lines, script `Devanagari`,
source-text manifest SHA-256
`eb16b5fe0535bd3717b259d3d3d9261b02f8931264cc6791b997c1e92b5d9eb3`, image
SHA-256 `d56055b686652226124bcf0d547a9bc2ad534046e032d7ba66d663e29888aa1b`,
reference SHA-256
`f24cf4e86eee07f150bdc78b50b292ba19a1852cb49a90e60a4e883230b298e5`, and pack
content SHA-256
`8a44efc5d89f22ff055269aa3bbf7fe30d088381bbdaf7e83be827b4ab8d493a`. The
sidecar-perfect score at `score-sidecar-perfect` is an eval-harness smoke check:
codepoint CER 0, grapheme CER 0, line F1 1.0, matched-line reading-order pair
accuracy 1.0 over 91 pairs, and no missing required graphemes in the script
inventory. Its audit passes artifact consistency but remains `claim_safe=false`
because the pack is synthetic, not frozen, one page, and not human verified. This
proves we can exercise Devanagari Limbu page-eval plumbing; it does not satisfy the
real Devanagari-written Limbu page requirement.
- Limbu page-source inventory gate:
`outputs/limbu-page-source-inventory-2026-06-21`. The command
`uv run tools/inventory_limbu_page_sources.py --out outputs/limbu-page-source-inventory-2026-06-21`
inspected curriculum page metadata, Sikkim Herald Limbu PDFs, Gorkhapatra Limbu
listings, local Devanagari text sources, and the synthetic Devanagari smoke pack. It
reports 36 records, 3 real Devanagari page candidates, 3 Devanagari text-only
sources, 1 Devanagari synthetic smoke pack, and `ready_for_real_devanagari_page_eval_draft=true`.
The three curriculum sources (`Maths`, `Science`, `Social`) are now backed by real
CDC Limbu PDFs fetched from `lib.moecdc.gov.np` using refs 3757, 3756, and 3758:
`mero_ganit_grade1_limbu.pdf` (111 pages, SHA-256
`25fb14113adeb8ca474de70d26bd53455ae7b424de9e92eb43d9028b11e4d186`),
`mero_vigyan_swasthya_grade1_limbu.pdf` (89 pages, SHA-256
`c24178a1789cad5cd209f9dccc8de54c7aa35cf28d7e5966221ccdd2ff2ee97e`), and
`samajik_adhyayan_grade1_limbu.pdf` (87 pages, SHA-256
`d32366b3a4f80b44817ba633cf25bc3395d3c3df7a418f7999c902d71e938502`).
Running the same inventory with `--require-real-devanagari-page` now exits 0. This
removes the real-source blocker for a Devanagari page-eval draft, but it is still not
claim-ready: the curriculum lines need page-image rendering, line/reference alignment
evidence, and human or spot-check review before quality claims.
- Devanagari-written Limbu CDC curriculum page draft:
`outputs/limbu-page-eval-drafts/limbu-devanagari-cdc-curriculum-2026-06-21`.
The builder `tools/build_limbu_devanagari_curriculum_page_eval_draft.py` renders real
CDC Limbu PDF pages and pairs them with the curriculum JSON line text. The current
pack contains three real page images: Maths page 8 with 14 lines, Science page 9 with
9 lines, and Social page 9 with 8 lines. Pack content SHA-256 is
`d587e9ee5cc2983f761142c18de071c2578218d41341b5b2058409e1294ef333`; manifest
SHA-256 is `2a708b3dbd444a05329343482452648e1cc3ecc34954860c95e2935737c10522`.
The sidecar-perfect score at `score-sidecar-perfect` verifies text/reference plumbing:
3/3 pages scored, codepoint CER 0, grapheme CER 0, text exact accuracy 1.0, and
reading-order pair accuracy 1.0. It also confirms the real limitation:
reference coverage has text=3 and reading_order=3, but line_bboxes=0 and
line_alignment_scored=0. The score audit is intentionally not passed and not
claim-safe because there are no line-bbox references, no layout references, only
three pages, the pack is not frozen, and the GT status is
`curriculum_text_unreviewed`. This closes the "real Devanagari page draft exists"
gap; it does not close the claim-grade Devanagari eval gap.
A follow-up line-box draft exists at
`outputs/limbu-page-eval-drafts/limbu-devanagari-cdc-curriculum-linebox-2026-06-21`.
It uses the same three page images, but aligns PDF word-group boxes to the curriculum
reference lines. The line-box pack has pack content SHA-256
`e696a92dee7ac49b4e81659aee7fb344af4c8fa0d4741c6cd43ef074cd052200`,
`line_box_source=pdf_words_machine_aligned`, and line-bbox reference coverage for
all 3 pages. Science drops 2 private-use marker PDF lines; Social drops 2 extra
trailing PDF lines. The sidecar-perfect score at
`score-sidecar-perfect` audits cleanly but remains `claim_safe=false`; it verifies
the line-layout harness with codepoint CER 0, grapheme CER 0, exact page accuracy
1.0, matched-line CER 0, reading-order pair accuracy 1.0, and line detection F1
1.0. These line boxes are still machine-aligned, not human-verified claim evidence.
Running the current Devanagari primary path on the same pack as
`parse-limbu-doc --engine tesseract` produced auditable but poor live outputs at
`live-tesseract-documents`; all three `audit-limbu-output` checks pass. The page
score at `score-live-tesseract-primary` is not claim-safe, but the quality signal is
still clear: 3/3 pages scored, codepoint CER 0.897862, grapheme CER 1.390169, exact
page accuracy 0, line-bbox coverage 0, and all 58 detected lines entered review. By
page, codepoint CER is 0.867220 for Maths, 0.908257 for Science, and 0.927536 for
Social. The emitted text is largely Latin/garbled mixed output rather than clean
Devanagari Limbu, so `nep+eng` Tesseract is not an adequate Devanagari-written Limbu
primary for these pages. A quick PSM/upscale sanity check did not rescue it; the best
tested setting was still roughly 0.87 codepoint CER.
The same Tesseract baseline was rerun on the line-box pack. It audits cleanly as a
non-claim diagnostic and repeats the bad page-text result: codepoint CER 0.897862,
grapheme CER 1.390169, exact page accuracy 0. Against the new line references, its
line detection F1 is only 0.385568 and matched-line codepoint CER is 0.869087.
A morphology line-detector diagnostic at `image-line-box-documents-tesseract`
detected 83 line-like boxes and ran Tesseract on the crops; 12 crop predictions were
empty. The line-box-pack score at `score-image-line-tesseract` improves page text
only slightly to codepoint CER 0.865400 and grapheme CER 0.937020, with exact page
accuracy 0, line detection F1 0.400301, and matched-line codepoint CER 0.872156.
The paired comparison at `compare-image-line-vs-fullpage-tesseract` shows a
non-claim-safe codepoint-CER improvement of 0.032462 over full-page Tesseract. This
is a detector/crop diagnostic, not a solution: line cropping helps a little, but the
Devanagari CDC pages are a legacy visual-register OCR problem and need a
same-register recognizer/data path plus better detection.
- Devanagari-written Limbu CDC recognizer crop draft:
`outputs/limbu-recognizer-eval-packs/limbu-devanagari-cdc-line-crops-2026-06-21`.
This pack is built by
`tools/build_limbu_devanagari_line_crop_recognizer_pack.py` from the CDC line-box
page pack. It crops the real rendered CDC page images by the machine-aligned line
boxes, writes PaddleOCR-style `eval.txt`, and preserves raw PDF legacy strings,
source page, source bbox, crop bbox, image hashes, and claim flags in
`manifests/recognizer-eval.jsonl`. It contains 31 real line crops, pack content
SHA-256 `6d76ab654a0c210a1291f397f2274878d116713a91010ccc91a62cf892ea09b0`,
and `line_box_source_counts={"pdf_words_machine_aligned": 31}`. The sidecar-perfect
recognizer score verifies the pack is runnable: 31/31 matched lines, codepoint CER 0,
grapheme CER 0, exact line accuracy 1.0. The diagnostic `nep+eng` Tesseract crop
run at `score-tesseract-nep-eng` has 31/31 matched predictions but codepoint CER
0.852632, grapheme CER 0.857143, and exact line accuracy 0. This is now the cleanest
Devanagari recognizer target: it removes page detection from the measurement and
still shows generic Tesseract failing on the CDC visual register.
A follow-up legacy-target analysis at `legacy-target-analysis-tesseract-nep-eng`
compares the same Tesseract predictions against both labels available for each crop:
Unicode Devanagari curriculum text and raw PDF legacy word text. Tesseract is not
closer to the raw legacy strings: Unicode codepoint CER is 0.852632, raw legacy
codepoint CER is 0.880213, and the analysis sets
`legacy_string_ocr_shortcut_supported=false`. So the likely path is not "OCR the
legacy Latin bytes, then transduce"; it is a same-register visual recognizer trained
or adapted on CDC-like line crops, with the raw legacy strings kept as provenance and
alignment evidence.
- Devanagari-written Limbu CDC line-crop corpus:
`outputs/limbu-recognizer-eval-packs/limbu-devanagari-cdc-line-crop-corpus-devclean-2026-06-21`
is the current same-register training/dev/eval artifact. It is built by
`tools/build_limbu_devanagari_cdc_line_crop_corpus.py` from all aligned CDC
curriculum pages. Alignment coverage is complete for the local curriculum source:
281/281 text pages align, yielding 6,446 raw line crops before leakage filtering.
The first large corpus had a 501-row dev split with train/dev leakage, so it should
not be used for model selection. The dev-clean corpus excludes train/dev rows that
overlap the held-out eval split by image hash, sample hash, or text hash, then also
excludes dev rows that overlap train by those keys. It leaves 5,551 train, 258 dev,
and 31 sealed eval rows across 254/24/3 pages. Corpus pack SHA-256 is
`36f10b8b123b792f643e206ca59e3bfd9ce03d5357b5de7ed1cdaba2b92145d1`; eval split
SHA-256 remains `6d76ab654a0c210a1291f397f2274878d116713a91010ccc91a62cf892ea09b0`.
Both the train/dev audit and the combined train+dev versus held-out eval audit pass
under Limbu-specific thresholds with real rows and no leakage. The eval Tesseract
baseline from the identical sealed split still fails at codepoint CER 0.852632,
grapheme CER 0.857143, exact line accuracy 0.0, and the eval legacy-target analysis
again reports `legacy_string_ocr_shortcut_supported=false`.
- Devanagari-written Limbu PP-OCRv5 training bundle:
`runs/limbu-devanagari-cdc-ppocrv5-mobile-training-bundle-2026-06-21` packages the
dev-clean corpus train/dev rows, staged images, a PP-OCRv5 mobile recognizer recipe,
and a passing corpus audit. Archive SHA-256 is
`01b3689603309c13cb31ef31ff7dc0def65b556a92269d33483ee11da6e8c14d`; bundle manifest
SHA-256 is `95322aa852b14662e22c53ddbc1ae8346f37a51a7d1ae8348ec4f7a5fbf8da9f`.
After extraction, run
`python PaddleOCR/tools/train.py -c training-recipes/ppocrv5-mobile-devclean/paddle_recognizer.yml`.
The sealed 31-line eval split is intentionally not inside the training recipe; use it
only for post-training admission diagnostics.
- Devanagari-written Limbu PP-OCRv5 training smoke:
`outputs/limbu-devanagari-cdc-ppocrv5-training-smoke-2026-06-21` is a 32-train /
8-dev CPU smoke subset made from the portable training bundle with
`tools/prepare_paddleocr_training_smoke.py`. It explicitly records
`sealed_eval_used=false`; the bundle's `labels/eval.txt` is PaddleOCR validation
naming for the dev split, not the sealed 31-row held-out eval pack. The smoke was run
from scratch for one epoch under `/tmp/ocrtech-paddle311/bin/python` and
`/tmp/PaddleOCR-v3.7.0`, completed 16 train iterations and 4 validation iterations,
saved `best_accuracy`, `latest`, and `iter_epoch_1` checkpoints, and was audited by
`tools/audit_paddleocr_training_smoke.py` with `audit_passed=true`, `issues=0`.
Smoke summary SHA-256 is
`998ef85358e1858c22bac5966ad00290c2e1809b5d1497d61bea38b94ebc73e7`; smoke audit
SHA-256 is `811950bacfb19bcc936fc84ed89cb617a6732aaa6ef6529cef19acfac37284a6`;
best checkpoint SHA-256 is
`3b41eab11423fa1ac3d53bcffd1c8108f211818a9adb7257bf5de25745115535`. This is
training-path readiness evidence only; it is not a quality result because it uses a
tiny subset and no pretrained initialization.
- Devanagari-written Limbu held-out admission recipe:
`configs/eval-harness-recipes-v1.json` now contains
`limbu-devanagari-cdc-ppocrv5-devclean-heldout`. It points at the dev-clean corpus
31-line eval split, uses the combined train+dev manifest only for leakage checking,
and validates with no structural issues. It remains non-claim-ready until a trained
checkpoint, packaged model card, reproducible prediction command, frozen pack, and
reviewed or calibrated references exist.
- Devanagari-written Limbu training/admission plan:
`configs/limbu-devanagari-ppocrv5-admission-plan-v1.json` is the machine-checkable
guardrail for the next GPU run. `tools/validate_recognizer_training_admission_plan.py`
verifies the bundle hashes, expected split counts, exact train+dev manifest identity,
zero train/dev/eval overlap by sample/image/text hashes, and the rule that checkpoint
selection may use only train/dev while the 31-line eval split is sealed. Current
validation reports `valid=True`, `training_ready=True`, and
`heldout_admission_ready=0`; this means the branch is ready to train, not ready to
claim or admit.
- Devanagari-written Limbu PP-OCRv5 full training job:
`outputs/limbu-devanagari-cdc-ppocrv5-training-job-2026-06-21` was materialized by
`tools/prepare_recognizer_training_job.py` from the admission plan. It writes
`recognizer-training-job.json` and an executable `run-training.sh` launcher using
`/tmp/ocrtech-paddle311/bin/python` and `/tmp/PaddleOCR-v3.7.0`. The job manifest
records 5,551 train rows, 258 dev rows, and the sealed 31-line eval split only as an
audit artifact with `used_for_training=false`; `archive_member_hits=[]` confirms the
exact sealed eval manifest/label paths are not in the training tarball. Job manifest
SHA-256 is `b241f1f0bb7a9011429598fd3c92e5aaffced5a1af6bcb796a81bf5927b611d8`;
launcher SHA-256 is `06a2787a34a1da197c78242c4d05c9b318322789de453af08c54f3b03be56831`.
The manifest has one warning: the bundle manifest records a required passing corpus
audit, but the audit JSON itself is not packaged in the archive. This is a launcher
and audit guard only; no full checkpoint has been trained or admitted.
- Devanagari-written Limbu PP-OCRv5 runtime pre-training preflight:
`tools/preflight_recognizer_training_job.py` now extracts the materialized training
bundle into an isolated audit workspace, parses the packaged PaddleOCR YAML, verifies
`Global.character_dict_path` and `Global.save_model_dir`, checks every train/dev
label row against extracted crop files, confirms manifest counts, rechecks sealed
eval hashes and archive exclusion, and imports `paddle`/`paddleocr` with the recorded
Python runtime. The real preflight at
`outputs/limbu-devanagari-cdc-ppocrv5-training-runtime-preflight-2026-06-21` reports
`ready_to_start_training=true`, `issues=0`, `warnings=0`, train rows `5551`, dev
rows `258`, missing label images `0`, malformed label rows `0`, Python `3.11.13`,
Paddle `3.3.1`, and PaddleOCR `3.7.0`. Report JSON SHA-256 is
`417b8fcb177edd038fe6739a50311656ef2e2930ef8b0ec910361b8b75594289`; Markdown
SHA-256 is `fdd24527d29f5576709427622f3c8b092461bb7ce2c77cc9533e971889392686`.
This is still only a pre-training launch gate, not a trained model or admission.
- Devanagari-written Limbu PP-OCRv5 current-host training launch:
`tools/prepare_recognizer_training_runtime_launch.py` generated
`outputs/limbu-devanagari-cdc-ppocrv5-training-launch-current-host-2026-06-21`.
This host is CPU-only (`compiled_with_cuda=false`), so the launcher records explicit
PaddleOCR overrides: `Global.use_gpu=False`,
`Global.save_model_dir=training-recipes/ppocrv5-mobile-devclean/checkpoints-current-host-cpu`,
`Train.loader.num_workers=0`, and `Eval.loader.num_workers=0`. The launch manifest
SHA-256 is `c56e9211058ff0df87e595fd926b607057339bd96b466468779c13c3eb90d27b`;
launcher script SHA-256 is
`1c58b3815ae1fc3e66026c7c51d6c81948749243d93a4d64afa3607dec77e4fd`. Training is
running in tmux session `limbu_devanagari_ppocrv5_training_20260621`; the latest
verified progress line is `epoch: [11/20], global_step: 7000` with CPU ETA around
`7:33:52`. This is an in-progress train/dev run only. After it finishes, run the
completion audit with the manifest's recorded `--workspace` and `--checkpoint-dir`
before exporting, packaging, or scoring sealed heldout.
- Devanagari-written Limbu PP-OCRv5 training status monitor:
`tools/monitor_recognizer_training_run.py` writes a structured status snapshot from
the launch manifest, tmux session, live training log, and checkpoint directory. The
current snapshot at
`outputs/limbu-devanagari-cdc-ppocrv5-training-status-2026-06-21` reports
`status=running`, `ready_for_completion_audit=false`, `issues=0`, `warnings=0`,
latest progress `epoch: [11/20], global_step: 7000`, `acc=0.375`,
`norm_edit_dis=0.778184`, `ips=2.44833`, ETA `7:33:52`, latest eval
`acc=0.20542634862688572`, `norm_edit_dis=0.6081954332798136`, best eval
`acc=0.20542634862688572`, `norm_edit_dis=0.6081954332798136` at epoch 11,
and `next_action=continue_monitoring_training`.
The monitor now records training-log age against a 900-second stale threshold; this
snapshot has `warnings=0`. The run is still active, so it is not ready for completion
audit yet. Status JSON SHA-256 is
`d0c2a2bebe9a6a9d1bd5938092247e9ff968714b8708d16d49735943930f4a50`;
Markdown SHA-256 is `9d991c83d98ad85934e05954a88d9761cfd6773c9c232b343456410f3ce20b8c`.
Re-run this monitor until it reports `ready_for_completion_audit=true`, then run the
completion audit; do not score the sealed heldout split before that.
- Devanagari-written Limbu PP-OCRv5 training completion audit:
`tools/audit_recognizer_training_completion.py` is the next gate after the long
training job finishes. It verifies that the training workspace exists, the PaddleOCR
config and dictionary resolve, the selected `best_accuracy` checkpoint is inside the
train/dev workspace, and the sealed eval is still post-selection only. When green, it
writes the export command, package command, sealed-eval prediction command, and a
resolved held-out eval recipe using `runner.type=model_config`. The current audit at
`outputs/limbu-devanagari-cdc-ppocrv5-training-completion-audit-2026-06-21` is
intentionally red: `ready_for_export=false`, `issues=5`, because the training
workspace/checkpoint do not exist yet. Audit JSON SHA-256 is
`3fe15749a5c2a83ce9a764c8cc98f9cfe8b107b33d7eb2be728cf831346ef516`; Markdown
SHA-256 is `8e9c9678a4a042a52b9803557b6ff3788b09a4eef05372a11746965354f93890`.
- Generic Devanagari v2 export preflight:
`outputs/limbu-devanagari-primary-candidate-deva-v2-export-preflight-2026-06-21`
now records a PaddleOCR export, package, model-card audit, and CDC held-out score for
`outputs/devanagari-recognizer-v2-2026-06-18/deva-v2.tgz` (archive SHA-256
`7e81660674468f99b2940224fe5ef3e7c9d062d6a05fd3cf4dabf52ac9b4e1df`). The extracted
checkpoint SHA-256 is
`ddea1db34e89e2c1cdde53d5364eb9156b26dbe8e0a5e67db4c26dd9c97e6676`; export recipe
SHA-256 is `6e18a8cfcf8ebab247be910f9566b30327f10dcd3aef2270ec3979960f7b86c3`.
`/tmp/PaddleOCR-v3.7.0` was restored at commit
`b03f46425e8ff4442b268ce449e3eef758146cd4`; export required overriding the relative
dictionary path and forcing CPU. The packaged line-recognition model card audits
cleanly at
`outputs/limbu-devanagari-primary-candidate-deva-v2-export-preflight-2026-06-21/package/model-card.json`
(SHA-256 `0c41a9811484349805cd608410da3626b795c1601a7ba014c0e23bca69c0efd0`).
Prediction on the 31-row CDC sealed eval split had 0 runtime failures, but the score
is still terrible: codepoint CER 0.835628, grapheme CER 0.858748, exact-line accuracy
0.0, and `claim_safe=false`. The score bundle audit at
`outputs/limbu-devanagari-primary-candidate-deva-v2-export-preflight-2026-06-21/score-cdc-heldout-audit`
passes with zero issues and `claim_safe=false` (SHA-256
`8a538059a0320902196b3a1125edd97b34f21cb9afb4f32826f24c4c08135edf`). Treat
`deva-v2` as a failed generic baseline, not a Devanagari-written Limbu primary.
- Sikkim Herald Sirijonga crop:
`outputs/limbu-dual-script-real-run-2026-06-21/sikkim-sirijonga-crop-ocr-v4-guarded`.
Capture audit and output audit pass. The updated auto line-recognition path now emits
Sirijonga Unicode and classifies the line as `limbu_sirijonga`, but the line still
remains in the review queue: confidence is 0.797, and the
diagnostic codepoint CER against
`data/sikkim-herald/limbu/_evalpack_demo/line_crop_demo.gt.txt` is about 0.095. This
improves over the earlier deployed component's roughly 0.302 diagnostic CER, but it
is still a single demo crop, not claim-grade scoring.
- Sikkim Herald Sirijonga page:
`outputs/limbu-dual-script-real-run-2026-06-21/sikkim-sirijonga-page-ocr-v4-guarded`.
Capture audit and output audit pass. The full-page path emits 22 lines; 20 enter
review, average confidence is 0.635, and quality fails at 0.619. The guard protected
one Devanagari-looking primary line, but the page remains low quality. This is useful
page-level operational evidence, not a success claim.
- Sikkim Herald Sirijonga page draft eval:
`outputs/limbu-page-eval-drafts/sikkim-sirijonga-2020-12-03-page1-v1`.
The draft reference was built from the PDF text layer with the Sikkim Herald Limbu
legacy-font converter and scaled to the prepared page image. It has 86
machine-converted Sirijonga reference lines and is explicitly not claim evidence
(`gt_status=machine_converted_unreviewed`, `claim_evidence_eligible=false`). Scoring
the guarded live-detector OCR output against this draft as
`--ocr-output-kind live_detector` gives codepoint CER 0.891560, grapheme CER
0.897412, line detection F1 0.018519, and only 1 matched line out of 86 references.
The score audit passes artifact consistency but remains `claim_safe=false`, as it
should. A second diagnostic materialized the same 86 PDF-derived reference boxes as
line crops, forced the v4 Sirijonga component into recognizer-only
`recognition_mode=line`, and scored the resulting document as
`--ocr-output-kind oracle_line_boxes` at
`outputs/limbu-page-eval-drafts/sikkim-sirijonga-2020-12-03-page1-v1/score-oracle-line-boxes-v4`.
That oracle-box run has 86/86 matched lines, line detection F1 1.0, codepoint CER
0.274289, and grapheme CER 0.548983. The paired comparison at
`outputs/limbu-page-eval-drafts/sikkim-sirijonga-2020-12-03-page1-v1/compare-oracle-vs-live-v4`
shows a non-claim-safe codepoint-CER improvement of 0.617272 over the live detector.
This proves detection/layout is a major failure, but the remaining oracle-box CER is
still too high; the Sikkim Herald register and/or the draft machine-converted
reference also need recognizer and label-quality work. A third diagnostic at
`outputs/limbu-page-eval-drafts/sikkim-sirijonga-2020-12-03-page1-v1/image-line-box-documents-v4`
uses `tools/materialize_page_image_line_boxes.py`: it detects line-like components
from image pixels using Otsu thresholding and morphology, computes final boxes from
ink pixels, gives the recognizer 12 px of crop margin, and forces the v4 recognizer
to `recognition_mode=line`. Scored as a live detector at
`score-image-line-detector-v4`, it emits 125 lines, matches 59/86 references, reaches
line detection F1 0.559242, codepoint CER 0.460255, and grapheme CER 0.576710.
That is materially better than the current Paddle live detector but still well short
of oracle boxes. A detector-only reading-order comparison at
`outputs/limbu-page-eval-drafts/sikkim-sirijonga-2020-12-03-page1-v1/compare-detector-reading-order-column-major-v1`
compares `top_to_bottom` and `column_major` with the same detector settings; both
modes score matched-line reading-order pair accuracy 0.992402. A bounded detector
parameter sweep at
`outputs/limbu-page-eval-drafts/sikkim-sirijonga-2020-12-03-page1-v1/detector-param-sweep-v1`
evaluated 900 morphology configs and did not improve on the current detector family:
best line F1 remains 0.559242 with 125 predictions for 86 references and 59 matches.
Keep this as a detector prototype, not the production default: the Sikkim blocker is
overprediction, missed/merged lines, recognizer register quality, and reference
verification, not a simple morphology parameter or column-major ordering switch.
The interpretation is blunt: the router is now closer to the required two-script shape,
and the v4 recognizer materially improves a real Sirijonga line crop, but full-page
Sirijonga quality is still poor. We now have multiple Sirijonga/Namdhinggo page
diagnostics, a Devanagari-written Limbu synthetic smoke pack, and a real CDC
Devanagari-written Limbu text-only page draft. The Devanagari side is no longer blocked
on source discovery, but the current Tesseract primary fails badly on that real CDC
draft. It is still not claim-grade until the CDC pages get reviewed text, image line
boxes, enough held-out pages, and a Devanagari-written Limbu recognizer or OCR primary
that works on this register.
## Next Engineering Target
Do not spend more effort polishing generic audit scaffolding before measuring the core
failure. The next useful milestone is a tiny frozen two-script page eval pack and a
detector-vs-recognizer diagnostic:
- keep `configs/eval-target-coverage-v1.json` as the top-level claim coverage gate.
Its `limbu-first-two-script-ocr` target set must show both `limbu/Limbu` and
`limbu/Devanagari` as coverage-ready before any two-script Limbu OCR claim. This
target set requires both recognizer eval recipes and full page-level eval recipes,
so recognizer-only readiness cannot satisfy the page-capture goal.
- promote at least one Sirijonga page reference from machine-converted draft to reviewed
status, and promote the CDC Devanagari draft from text-only reference to reviewed
page reference with source image hashes, source document/page/bbox provenance, GT
trust status, claim eligibility, and line-level image boxes. The existing Devanagari
smoke pack is useful for harness regression only; the CDC pack is the real-page
draft, but it is not a substitute for reviewed line-bbox evidence. Use
`tools/inventory_limbu_page_sources.py --require-real-devanagari-page` as the
source-readiness gate before claiming new Devanagari sources exist
- score the same pages twice: once with live detector boxes from `parse-limbu-doc`, and
once with oracle/PDF-derived line boxes passed to the recognizers; record these
scorer runs as `--ocr-output-kind live_detector` and
`--ocr-output-kind oracle_line_boxes`
- if oracle boxes recover the line-crop-level quality while live detector boxes fail,
prioritize a Sirijonga-capable text detector and reading-order path; that is the
oracle-quality Gorkhapatra finding. If live-detected boxes have good geometry but
high matched-line CER, as the current tuned Gorkhapatra morphology detector does,
improve crop tightness, crop padding, line splitting/merging, and line-recognizer
robustness before celebrating detector F1. If matched-line reading-order accuracy is
materially below oracle, improve column/article ordering from aligned-line evidence
rather than relying on raw reading-order IDs. `tools/materialize_page_image_line_boxes.py`
now exposes `--reading-order column_major` and `--reading-order auto_layout` as
explicit diagnostics alongside the default `top_to_bottom`. `auto_layout` records the
requested mode, selected mode, and layout features in each materialized document.
`tools/compare_limbu_sirijonga_detector_reading_order.py` now provides a
recognizer-free way to compare those modes against reference line boxes; current
Gorkhapatra and Sikkim runs show zero delta for `column_major`, while `auto_layout`
recovers the Gorkhapatra wide-RTL ordering gain without flipping Sikkim. Keep this as
measured layout selection, not claim-grade OCR quality. `tools/sweep_limbu_sirijonga_detector_params.py`
ranks detector-only morphology configs before recognizer runs; the current sweep finds
a minor Gorkhapatra precision improvement and no Sikkim improvement. If oracle boxes remain
high-CER as they do on the current Sikkim draft, split work between detector improvement,
same-register recognizer data, and reference verification
- calibrate the Devanagari primary guard and review thresholds against page CER instead
of treating Tesseract confidence or script ratios as evidence. The current CDC
diagnostic shows this calibration cannot be a threshold tweak only: `nep+eng`
Tesseract is around 0.898 codepoint CER on the real Devanagari draft, so a stronger
Devanagari-written Limbu recognizer/data path is required
## Outputs
Each run writes the normal parser outputs:
- `document.json`
- `document.md`
- `quality.json`
- `tables/`
- `figures/`
The Limbu wrapper also writes:
- `limbu-capture-prep.json`: raw/prepared image paths, hashes, cleanup operations, source/prepared image-quality metrics, timestamp, and run context
- `limbu-capture-audit.json` / `.md`: verification that the raw copy, prepared image, recorded hashes, decodable image bytes, image-quality metrics, and capture operation metadata are still consistent
- `capture-prep-audit/limbu-capture-audit.json` / `.md`: the capture audit copied into an OCR output bundle when `--capture-prep-metadata` is used
- `limbu-pipeline-audit.json`: run-level line counts, script counts, thresholds, and claim scope
- `limbu-line-audit.jsonl`: one row per OCR line with Sirijonga/Devanagari ratios and review flags
- `limbu-post-correction-audit.json`: deterministic Limbu post-correction status, profile id/path/hash, rule count, changed count, and claim scope
- `limbu-post-correction-lines.jsonl`: one row per OCR line with original text, corrected text, applied rule ids, and changed flag
- `limbu-review-queue.tsv`: only lines that need human review
- `limbu-review-dashboard.html`: a static review dashboard that pairs each queued line with its crop, script class, confidence, review reasons, OCR text, and TSV correction row
- `line-crops/manifest.jsonl` and `line-crops/summary.json`: one crop-lineage row per OCR line, with crop paths/hashes when the source page is croppable
- `limbu-correction-audit.json`: accepted review corrections applied to a corrected document
- `limbu-correction-pairs.jsonl`: noisy/clean line pairs for future Limbu-specific corrector training
- `limbu-output-manifest.json`: run context, input provenance, and paths, sizes, and SHA-256 hashes for emitted artifacts
- `limbu-output-audit.json` / `.md`: verification that the output manifest, artifact hashes, counts, and stage-specific audits are still consistent
Lines enter the review queue when confidence is missing, confidence is below the chosen
effective threshold, the line mixes Devanagari and Sirijonga, or the output contains
neither script. `parse-limbu-doc` keeps the global `--low-confidence-threshold` default
but can override it per script with `--sirijonga-low-confidence-threshold`,
`--devanagari-low-confidence-threshold`, `--mixed-script-low-confidence-threshold`, and
`--other-script-low-confidence-threshold`. These threshold inputs, plus
`script_ratio_threshold`, are validated as finite ratios in `[0, 1]` before OCR
artifacts are emitted, so booleans, `NaN`, and out-of-range values cannot silently alter
review routing or script classification. The audit replay validates the embedded
`limbu-pipeline-audit.json` thresholds again before using them, so a refreshed manifest
hash cannot legitimize invalid script-classification policy. `limbu-line-audit.jsonl`,
`limbu-review-queue.tsv`, and `limbu-review-dashboard.html` record the effective review
threshold for each queued line so script-specific triage is replayable. The review TSV
is intentionally simple so corrections can become future calibration or post-correction
training data; `limbu-review-dashboard.html` is the human-facing contact sheet for those
same rows and is included in the manifest hash contract.
`audit-limbu-output` replays line triage from `document.json`: it recomputes script
class, effective review threshold, review reasons, `needs_review`, script counts, and
review-line count, then fails if `limbu-line-audit.jsonl`, `limbu-review-queue.tsv`, or
`limbu-pipeline-audit.json` drift from the document. Review queue replay includes the
queued confidence, so a low-confidence line cannot be silently presented to reviewers as
high-confidence text.
For operational digitization runs, `audit-limbu-output` also has opt-in strict policy
gates: `--require-capture-prep` requires a passing capture-prep audit to be bound into
the OCR output and replays the current capture-prep metadata/artifact hashes from disk,
the `--min-capture-prepared-*` flags forward prepared-image quality thresholds into
that capture replay and fail low-resolution, low-texture, or low-contrast prepared
images. Those capture-threshold policy inputs are validated as finite non-negative
numbers before audit work starts, so invalid thresholds fail as configuration errors,
`--require-no-pending-review` fails OCR outputs that still have review lines or
correction outputs with skipped review rows, and repeated `--require-script`
flags require observed line counts for specific script classes such as
`limbu_sirijonga` and `devanagari_limbu`. Required script names are normalized and
validated against the fixed Limbu script-class vocabulary before audit work starts, and
boolean count values are rejected instead of being treated as `1`, so misspelled or
ambiguous policy inputs fail as configuration errors instead of becoming ordinary
missing-script output failures. For stricter acceptance,
`--require-script-count SCRIPT=COUNT` requires a minimum observed line count for a
script class, so a token-level accident or one-line smoke cannot satisfy a real
two-script coverage policy. `--min-line-count`, `--min-average-line-confidence`, and
`--min-quality-score` add explicit output-volume and quality gates using the audited
`document.json` quality metadata, and `--min-line-count` rejects boolean API values, so a
nearly empty or low-confidence output cannot pass strict acceptance only because
provenance and script classes are present. These flags
are intentionally not defaults:
development and diagnostic bundles can still be audited for artifact integrity, while
real page digitization can demand capture provenance, prepared-image quality, zero
unresolved review rows, enough text volume, minimum quality, and the expected script
coverage. For capture-prep bundles themselves, use
`audit-limbu-capture --require-metadata-path-self` so copied or renamed metadata cannot
quietly stand in for the recorded `metadata_path`; for full OCR output bundles, use
`audit-limbu-output --require-capture-metadata-path-self` to enforce the same check
during capture replay. A fresh two-script smoke at
`outputs/limbu-strict-output-policy-smoke-2026-06-21` passed the strict policy with
`require_capture_prep=true`, `require_no_pending_review=true`, and required scripts
`limbu_sirijonga` plus `devanagari_limbu`; strict audit JSON SHA-256 is
`2fc71f191ba581d58f59480b54695a9297778f3c54a2a63c8a7da339d618142e`.
Only rows whose `review_status` is accepted by
`apply-limbu-review-corrections` are applied; duplicate accepted targets and accepted
rows with empty `corrected_text` fail explicitly. Accepted review rows also use the
same constrained `script_class` vocabulary as correction-pair packs and post-correction
profiles; explicit typos fail in both the writer and the audit replay path.
For `review_correction` bundles, `audit-limbu-output` now replays the accepted TSV
rows from the original `document_path` and `review_queue_path` recorded in
`limbu-correction-audit.json`, verifies their SHA-256 hashes, binds manifest
`provenance.input_document` and `provenance.review_queue` to those same paths/hashes,
recomputes applied, changed, and skipped counts using the source OCR document's recorded
`script_ratio_threshold`, then compares the replayed document text and
`limbu-correction-pairs.jsonl` rows against the emitted corrected bundle. It also
replays the corrected line's embedded `metadata.limbu_pipeline` review flags and
`post_correction` reviewer/status/original/corrected-text metadata. This means a
corrected `document.json`, embedded correction story, or training-pair JSONL cannot be
trusted just because the files exist or the counts match; they must be reproducible from
the source OCR document and the reviewed queue. For claim-grade corrected bundles, add
`--require-reviewer-for-corrections`; this strict policy fails accepted correction rows
whose reviewer field is blank while still allowing quick non-claim experiments to run
without reviewer metadata.
## Post-Correction Boundary
The current automatic post-correction lane is deliberately deterministic. If
`--post-correction-profile` is supplied, the profile must be a Limbu JSON object with a
`profile_id`, `language=limbu`, `script_scope`, and exact/token rules whose replacements
contain Limbu or Devanagari text. Rule IDs must be unique. `script_scope` and
rule-level `script_class` values must be one of `limbu_sirijonga`,
`devanagari_limbu`, `mixed_limbu_devanagari`, or `other`; typo aliases such as
`sirijonga` are rejected instead of silently disabling a rule. The profile is applied
before review export, and every line records original text, corrected text, applied rule
ids, profile hash, profile admission status, and changed status. With no profile, the
same artifacts are still written with `status=not_configured`, so missing automatic
correction is visible.
Profile admission is intentionally separate from profile shape. A profile with no
`admission` object can run, but it is marked `experimental` and `audit-limbu-output`
warns that automatic corrections are not claim-ready. A profile that claims
`admission.status=validated` must record a hashed eval artifact, frozen eval-pack
identifier, metric name, and before/after metric values where `after <= before`;
otherwise `parse-limbu-doc` fails instead of applying the profile. This keeps
language-specific post-correction useful for triage without letting it become an
unverified accuracy claim.
The human-reviewed correction lane remains separate. That is intentional: prior generic
text-corrector experiments made OCR substantially worse, so any learned Limbu corrector
should be trained only from reviewed Limbu correction pairs and admitted through the same
held-out eval discipline as recognizers. The corrected document records the original OCR
text, corrected text, reviewer/status, review TSV hash, and
`post_correction.status=human_review_applied` on each changed line; it also records the
source OCR document's `script_ratio_threshold` so inferred correction-pair script classes
use the same script policy as the reviewed OCR output. Output audit now replays those
embedded fields against the source document and accepted review TSV.
`build-limbu-correction-pair-pack` canonicalizes accepted noisy/clean pairs into a
frozen train/heldout correction pack with source pair-file hashes, deterministic
SHA-256 split selection, a pack-content digest, and `claim_eligible=false` rows. The
heldout split is the input for post-correction profile scoring; the pack is calibration
evidence, not page OCR ground truth.
`audit-limbu-correction-pair-pack` independently replays that pack: it checks the
summary artifact, train/heldout file hashes, row counts, split labels, duplicate sample
IDs, row text shape, source pair-file hashes when available, and the canonical
`pack_content_sha256`. Run it before using the train split for profile derivation or
the heldout split for admission scoring.
`derive-limbu-post-correction-profile` converts accepted
`limbu-correction-pairs.jsonl` rows into exact-match deterministic rules only after
normalizing the noisy/clean text, dropping unchanged rows, hashing every source pairs
file, enforcing minimum support, and rejecting conflicting mappings from the same noisy
text to multiple clean texts. The generated profile is still marked
`admission.status=experimental`; it is useful for repeatable triage, not claim-ready
automatic correction, until a frozen held-out post-correction eval is attached and
passes `audit-limbu-post-correction-profile`.
`score-limbu-post-correction-profile` applies the same profile loader and rule engine
used by runtime OCR to held-out noisy/clean pairs. It writes
`limbu-post-correction-profile-eval.json`,
`limbu-post-correction-profile-eval-lines.jsonl`, and Markdown, reporting
`text_cer_codepoint_micro` before and after correction, changed/improved/regressed row
counts, source pair-file hashes, profile hash, and the eval JSON SHA-256 printed by the
CLI. The score fails if aggregate codepoint CER regresses or if any held-out row gets
worse. A profile can only claim `admission.status=validated` after that eval JSON hash
is copied into `admission.eval_run_sha256` with the frozen eval-pack identifier and
non-regressing before/after values.
`admit-limbu-post-correction-profile` performs that admission copy under guard. It
refuses failed evals, eval/profile SHA mismatches, missing frozen eval-pack identifiers,
non-numeric metrics, aggregate regressions, and any regressed held-out row. It writes a
new `limbu-post-correction-profile-admitted.json`, an admission report, and an audit
directory; the source profile is not mutated in place.
Both OCR and correction stages write `limbu-output-manifest.json`, so a reviewer can
verify exactly which artifacts were produced by that stage and whether any expected
artifact is missing. OCR manifests also hash the model card, fallback model card,
capture-prep metadata, and post-correction profile when supplied; review-correction
manifests hash the source document and review TSV. `audit-limbu-output` recomputes those
provenance hashes, replays manifest `source_path` / `source_sha256` and binds the source
path fields to `document.json.source_path`, checks OCR capture-prep/profile provenance against
`limbu-pipeline-audit.json` and `limbu-post-correction-audit.json`, and, for
review-correction bundles, checks that the manifest points to the same source document
and review TSV recorded in `limbu-correction-audit.json`, so changed or substituted
capture/model/profile/review inputs make the bundle fail audit.
It also enforces the fixed required artifact set for OCR and review-correction stages;
removing a required artifact from `limbu-output-manifest.json` is itself an audit
failure, even if the file still exists on disk.
`audit-limbu-output` recomputes artifact hashes, validates document counts against the
manifest, checks OCR line/post-correction/review/crop counts, verifies capture-prep audit
status when present, reruns the capture-prep audit into `capture-prep-replay-audit/`,
verifies post-correction profile hashes and crop hashes when they exist, replays
image-line crop manifests against `image-line-ocr-run.json` and the current crop PNG
hashes, checks kept image-line crop rows against `document.json` line ids, bboxes,
text, confidence, and embedded crop provenance, checks image-line run metadata against
the current source image and the duplicated document/page metadata, binds image-line
model config metadata to `limbu-output-manifest.json` provenance path/hash, replays
image-line detector source-pass count summaries when present, checks that review
queue triage fields, including confidence, still match the `needs_review` rows in
`limbu-line-audit.jsonl`, replays each `document.json` line's embedded
`metadata.limbu_pipeline` script ratios, script class, review flag, review reasons, and
effective review threshold from the current line text/confidence after validating the
embedded replay thresholds, replays embedded
`post_correction` metadata from `limbu-post-correction-lines.jsonl` and
`limbu-post-correction-audit.json`, and checks that the review dashboard card count, displayed
line metadata, displayed confidence, displayed OCR text, TSV copy row, and crop link
still match the review queue and crop manifest. For corrected bundles, it then replays
the review-correction audit from the original source document and review queue, verifies
the recorded input hashes, and checks corrected document text plus noisy/clean
correction pairs against that replay.
When strict policy flags are used, the generated `limbu-output-audit.json` records the
policy object beside the pass/fail result so later reviewers can tell whether an output
was merely artifact-consistent or operationally acceptable for the intended capture and
script scope.
## Capture And Cleanup Requirements
The capture source should preserve page detail before OCR:
- use full-page still images as the OCR input contract
- if moving-camera material exists upstream, convert it outside this pipeline into sharp
still page images before capture cleanup
- deskew and perspective-rectify before line recognition
- keep the raw still image, rectified page, line crops, OCR JSON, and review TSV together
- never overwrite a raw capture with a cleaned image
The current capture command preserves the raw image, applies EXIF transpose, optional
manual crop, optional automatic four-corner page detection, optional manual four-corner
perspective rectification, optional automatic text deskew, optional
manual rotation, grayscale conversion, and autocontrast. `--auto-detect-page` searches
for a large convex page contour and records the detected quad plus area ratio before
rectification. `--auto-deskew` first uses OpenCV near-horizontal line evidence to
estimate skew after crop/perspective cleanup, then falls back to row-projection scoring
over text ink so fragmented glyph rows can still be deskewed. It records either the
detected/applied angle or a skipped status when the page does not contain enough
evidence; use
`--max-auto-deskew-degrees` to cap automatic rotation. `--perspective-quad` uses corners
in this order: top-left, top-right, bottom-right, bottom-left, measured after EXIF
transpose and after the optional crop. It does not implement moving-frame selection;
that is outside this OCR pipeline's input contract. `limbu-capture-prep.json` records
the operation sequence, raw and prepared hashes, source/prepared image-quality metrics
including size, luminance spread, edge spread, and entropy, timestamp, and
command/runtime context when run through the CLI.
`audit-limbu-capture` verifies the raw copy and prepared image hashes, validates capture
operation metadata, checks existing capture artifacts are decodable images, replays
recorded quality metrics for available images, fails stale or missing prepared artifacts,
and only warns if the original source path has moved after the raw copy was preserved.
For frame-extracted stills or field captures, pass opt-in quality gates such as
`--min-prepared-width`, `--min-prepared-height`, `--min-prepared-entropy`,
`--min-prepared-luminance-stddev`, and `--min-prepared-edge-stddev`; the audit records
the chosen `quality_policy` and fails prepared images below those thresholds.
When `parse-limbu-doc` receives a croppable prepared page image, it also writes tight
line crops under `line-crops/` using the OCR bboxes; non-croppable sources still get a
line-crop manifest with warnings so missing crop lineage is visible.
## Claim Boundary
This pipeline is operational evidence. It is not enough for a paper claim unless the same
outputs are scored against frozen page references with source-image hashes, page/line
provenance, ground-truth trust labels, script inventory coverage, leakage checks,
confidence intervals, and worst-page review artifacts.
The current real-page diagnostic baseline is
`outputs/limbu-measured-page-baseline-2026-06-22/README.md`. Treat it as engineering
evidence only, not a public result: the references are unreviewed or machine-converted,
the packs are not frozen/claim-eligible, and current audits are not clean under the
latest stricter page-audit rules. The important signal is accuracy direction: Devanagari
CDC pages need the active PP-OCRv5 recognizer before the result is meaningful, while
Sirijanga Gorkhapatra/Sikkim pages are dominated by detector/layout misses before
recognition quality.
The current Devanagari page-marker-v2 candidate is now registered in the eval harness as
`limbu-devanagari-cdc-page-marker-v2-champion-coverage-gated`, and the
`limbu-first-two-script-ocr` coverage target points the Devanagari page-eval slot at it.
That is not a readiness claim. The latest validators report
`recipes=12 valid=True claim_ready=0` and
`valid=True coverage_ready=False target_sets=3 gaps=50`; the top-level two-script set
still has 6 gaps across Sirijonga/Limbu and Devanagari normalization, recognizer, and
page recipes. The Devanagari slot is operationally registered but blocked by 3-page
draft scope, 0 claim-ready references, unreviewed GT, unfrozen rows, missing
hash-verifiable model artifacts, `claim_safe=false`, and unresolved review rows.
The Sirijonga page recipe is now reproducible as a sidecar replay through
`tools/copy_page_ocr_document.py`; it replays the current operational
`conf070` page-document bundle into `run_eval_recipe.py` and records hashes. The smoke
run at `outputs/eval-recipe-smoke-limbu-sirijonga-gorkhapatra-page-current-router/`
passes audit but stays `claim_safe=false`: 1 machine-converted unreviewed page, 0
claim-eligible rows, codepoint CER `0.739361`, line F1 `0.872458`, and matched-line CER
`0.046585`. This removes a harness reproducibility blocker, not the underlying OCR
quality or data-readiness blockers.
The current selected Sirijonga diagnostics now have review packets for unresolved page
regions: `outputs/limbu-sirijonga-page-unresolved-review-2026-06-22/`. Gorkhapatra
`conf070` contributes 69 textless review crops, mostly center-column missed lines;
Sikkim same-row merge contributes 22 textless review crops, split between missed lines
and extra predictions. Both packet audits pass with 0 hidden-reference leaks. Use these
packets as the next layout/recovery substrate before another detector sweep.
The packets now include a blank `corrected_text` review field, and
`tools/apply_unresolved_page_review_packet.py` applies reviewed rows back to scoreable
page-document projections. Pending rows are no-ops; accepted/corrected
missed-reference rows require non-empty `corrected_text`; accepted/corrected unmatched
predictions update the existing line only when `corrected_text` is supplied; false
positives are deleted only with explicit `drop`/`delete` statuses. Pending application
smokes exist for both Sirijonga diagnostics and score identically to the source
outputs: `gorkhapatra-operational-conf070-review-application-pending` at codepoint CER
`0.739361` and `sikkim-same-row-merge-review-application-pending` at codepoint CER
`0.418057`. `tools/audit_unresolved_page_review_coverage.py` independently verifies
that these packets cover every current unmatched alignment row without writing hidden
reference text: Gorkhapatra covers 67/67 missed references and 2/2 extra predictions;
Sikkim covers 9/9 missed references and 13/13 extra predictions.
The strongest current Gorkhapatra Sirijonga recovery evidence comes from the rejected
auto-split-tall branch, but only as a review source. The selected `conf070` documents
compared against auto-split-tall yielded 100 candidate-only page rows with a passing
packet audit. Oracle/reference-overlap analysis shows 49 of those rows correspond to
the 67 currently missed references, and applying their candidate OCR text through
`tools/apply_candidate_page_line_reviews.py` raises line F1 to `0.964346` with
precision `0.993007` and recall `0.937294`. That is not a usable text-output win:
page codepoint CER worsens to `0.766779` from selected `conf070`'s `0.739361`, and
grapheme CER worsens to `0.798907`. The operational action is therefore to keep
auto-split-tall rows in the non-oracle prioritized review queue at
`outputs/limbu-sirijonga-page-unresolved-review-2026-06-22/gorkhapatra-auto-split-tall-prioritized-candidate-line-review/`
(100 body-line candidates, 99 high priority, audit passed), then accept reviewed
transcriptions or improve recognition on those crops before insertion. Do not make
auto-split-tall candidate text the default book OCR output.
The corresponding non-oracle crop probe at
`outputs/limbu-sirijonga-page-unresolved-review-2026-06-22/gorkhapatra-auto-split-tall-candidate-line-text-crop-probe/`
processed all 100 body-line candidates and refined 44 by trimming top bleed from
multi-row crops. Use it for targeted Sirijonga recognizer/reviewer work; it is not an
application result.
Running the packaged v4 Sirijonga recognizer over those original/refined crops exposed
and fixed a harness issue: recognizer predictions can contain multiple text lines, so
`tools/predict_recognizer_eval.py` now flattens embedded newlines/tabs before writing
TSV. The refined-crop recognizer comparison changed 40/100 predictions and reached max
confidence `0.992109`, but remains `automatic_application_safe=false`. A strict
machine selector (`0.90` confidence, `0.05` confidence delta) slightly improves page
codepoint CER to `0.737090`, but lowers line F1 to `0.866545` and increases extras to
7. That is not acceptable as the default book OCR policy; it is a candidate source for
reviewed insertion or a better crop recognizer.
`tools/audit_candidate_page_line_application_effect.py` now enforces that distinction
for page-candidate insertions. The strict recognizer-probe application is rejected as
`book_ocr_objective_safe=false`: 6 inserted rows, only 1 match, 5 extras, and the one
matched inserted line has codepoint CER `0.888889`. For this product, a CER-only gain
with worse line preservation is a failed candidate.
The safe oracle-feature diagnostic for those 100 candidates is
`outputs/limbu-sirijonga-page-unresolved-review-2026-06-22/gorkhapatra-auto-split-tall-oracle-feature-analysis/`
(report / TSV SHA-256
`4c45a640338b6510b63bced5b903b847e4725ab87f544fb36ba7def7ac2e2bb0` /
`21e31ff240b2a40220b70b9f029237064b83c951509b6bea62ec9fc4855098bf`). It confirms the
deployable signal is not refined recognizer confidence: selected rows average much
lower refined confidence than rejected rows (`0.382649` versus `0.601181`), and the
strict `0.90` / `0.05` selector finds only 1 oracle-selected row out of 6. The useful
rows are instead longer and wider body-line candidates. Any future automatic Sirijonga
candidate insertion should therefore be a geometry/text-feature selector, not another
confidence-only threshold, and it must pass the page-level effect audit.
The first geometry/text selector pass confirms the boundary.
`tools/select_candidate_line_reviews_by_geometry_text_features.py` with
`min_candidate_text_length=30`, `min_bbox_width=80`, and y-band
`middle,bottom_or_right` selects 31 rows; oracle-overlap diagnosis marks all 31 as
useful missing-line candidates. Applying their machine text improves line F1 to
`0.933566` and recall to `0.881188` with no new extras, but page codepoint CER worsens
to `0.761733` and reading-order accuracy drops to `0.604292`, so the effect audit
rejects it. A looser `min_candidate_text_length=10` setting selects 38 rows, finds
35 useful candidates, adds 3 extras, and also fails. This is now a review/crop-target
worklist, not a promotion candidate.
Candidate insertion now supports explicit ordering strategies in
`tools/apply_candidate_page_line_reviews.py`. The old `geometry` mode is retained for
reproducibility, but it globally sorts by raw page/y/x and is poor for wide-column
Gorkhapatra. `preserve_source_append` preserves the selected source order and appends
reviewed candidate lines; on the 31-row precision selector it keeps all inserted rows
matched and raises reading-order accuracy from the geometry diagnostic's `0.604292` to
`0.750472`, though it still fails because candidate text worsens page CER. A
`source_reading_order` re-sort with `wide_column_right_to_left` was also tested and is
worse on this application. The 31 precision-first rows have a pending transcription
worklist at
`outputs/limbu-sirijonga-page-unresolved-review-2026-06-22/gorkhapatra-auto-split-tall-geometry-text-selection-len30-w80-y-midbot-transcription-worklist/`;
it has JSONL/TSV/HTML/labels, blank `corrected_text`, no reference fields, and 31/31
resolving crop links. `tools/audit_candidate_line_transcription_worklist.py` verifies
that worklist before review; the current audit passes with 31 pending rows, 0 crop
hash mismatches, 0 forbidden fields, and 0 issues.
The reviewed-worklist application bridge is now available as
`tools/apply_candidate_line_transcription_worklist.py`. It compiles accepted/corrected
worklist rows into candidate-page application JSONL only when `corrected_text` is
non-empty, the reviewer is not machine/oracle/auto, and crop hashes validate. The
current 31-row worklist is pending-only, so its pending compile accepts 0 rows and the
downstream candidate-page application inserts 0 rows; the scored output remains
identical to selected `conf070` (`0.739361` codepoint CER, line F1 `0.872458`). This is
the mechanical path for real reviewed text; it deliberately does not apply pending
machine suggestions.
A diagnostic-only oracle ceiling now prevents a bad next step. The helper
`tools/select_candidate_line_reviews_by_oracle_subset.py` joins the 31 geometry/text
worklist rows to the oracle/reference-overlap selected rows, producing an unsafe
reference-text ceiling artifact with 31 selected and 0 rejected rows. Even with perfect
reference text, the 31 insertions are not a book-OCR win under append or raw geometry:
line F1 improves to `0.933566` and misses drop to 36, but page codepoint CER worsens
to `0.771993` with `preserve_source_append` and `0.771825` with raw geometry ordering,
versus selected `conf070` at `0.739361`. The new `candidate_document_order` mode is
the promising direction: it uses candidate-document line order and bbox-IoU mapping,
bringing codepoint CER to `0.739024`, line F1 to `0.933566`, misses to 36, extras to
2, and reading-order accuracy to `0.775506`. It is still not admissible because
grapheme CER worsens to `0.778367`. Reviewed transcription is useful only if paired
with this slotting mode and grapheme-level normalization/text repair.
The non-oracle machine-text version under `candidate_document_order` confirms that
ordering alone is not enough: line F1 and reading order match the oracle-ceiling
surface, but page codepoint CER is `0.763078` and grapheme CER is `0.797416`. Do not
apply machine candidate text; use the 31-row worklist for corrected text or a better
crop recognizer, then insert with candidate-document order.
Further ablation says this is not just a bad subset choice. No reference-span group or
single row among the 31 improves both page codepoint and page grapheme CER under
candidate-document order. However, an oracle reference-order ceiling over the same
exact 31 rows drops page codepoint CER to `0.102355` and grapheme CER to `0.136823`
with line F1 `0.933566` and 0 effect-audit issues. The product path is therefore
layout/reading-order learning for full page assembly, not more detector thresholding.
`tools/analyze_page_reading_order_geometry.py` now turns that oracle order into a
21-chunk geometry target, showing that the missing deployable policy is article/block
ordering rather than a single column-major sort.
`tools/apply_page_reading_order_geometry_profile.py` is the current bridge from that
diagnostic target to an operationalizable mechanism: it applies a chunk profile to a
page-document projection and reorders lines by assigned profile chunk. With the
oracle-derived 21-chunk profile, the 31-row oracle-text projection scores codepoint CER
`0.095711` and grapheme CER `0.129700`; the same profile applied to non-oracle machine
candidate text scores codepoint CER `0.143146`, grapheme CER `0.198112`, line F1
`0.933566`, recall `0.881188`, misses 36, extras 2, and reading-order accuracy `1.0`.
The effect audit passes, but this is still not claim-safe or deployable because the
profile itself came from hidden eval alignment. The next real work is replacing that
oracle-derived profile with a reviewed/calibrated layout profile derived from page
images, templates, or observable article/block structure.
`tools/build_page_reading_order_geometry_profile.py` now provides that replacement
path for geometry review: it consumes geometry-only line-box application references,
rejects transcription text by default, requires explicit `--allow-pending` for seed
packets, and requires explicit `--allow-multi-source-profile` before mixing layouts.
On the current pending Sirijonga line-box packet, applying the packet as seed geometry
produces 2 samples and 389 line boxes. The separate pending Gorkhapatra seed profile
has 303 lines, 26 chunks, 25 jumps, and `profile_claim_safe=false`; when applied to
the same 31-row machine-text candidate projection it scores exactly like the
oracle-derived profile-order machine run: codepoint CER `0.143146`, grapheme CER
`0.198112`, line F1 `0.933566`, recall `0.881188`, misses 36, extras 2, and
reading-order accuracy `1.0`. This is important directionally but not operationally
safe yet: the rows are still pending, so the next required work is to complete the
geometry review and rebuild the profile without `--allow-pending`.
Use `tools/audit_page_reading_order_geometry_profile.py --require-claim-safe` before
promotion, and apply profiles in operational runs with
`tools/apply_page_reading_order_geometry_profile.py --require-profile-claim-safe`.
The current pending Gorkhapatra seed profile passes structural audit but fails
required-safe audit and is refused by the applier under that flag. This prevents
hidden-alignment or pending-review profiles from leaking into selected book OCR.
`tools/admit_page_reading_order_profile_application.py` is the final promotion gate for
profile-ordered page projections: it requires a safe profile audit, a profile
application report using the same profile hash, and a safe page objective effect audit.
On the current pending Gorkhapatra seed-profile projection, admission correctly rejects
the run despite the strong score because provenance is not safe (`admitted_operational=false`,
admission SHA-256 `02bcd20dc1a5598f92b9a251dd5ae4669171ba8d9429df4eb9c06cf33bc354b6`).
For multi-page books, use `--profile-map` rather than one global `--profile`. The
current pending seed map at
`outputs/limbu-sirijonga-line-box-review-packet-2026-06-21-pending-seed-profile-map.json`
maps Gorkhapatra and Sikkim pages to separate profiles. A map-driven Gorkhapatra
diagnostic reproduces the same metrics as the single-profile run while recording the
selected profile in `profile_usage`; admission still rejects it because the profile is
pending. `tools/audit_page_reading_order_profile_map.py` audits map coverage and
profile-audit linkage; the current map passes structural audit but fails required-safe
audit because the mapped profiles are pending. This is the safe shape for future
multi-page reviewed layouts: profile map -> profile-map audit -> required-safe
application -> effect audit -> admission.
`tools/parse_limbu_book_pages.py` can now apply that profile map inside the book run
with `--reading-order-profile-map`. It applies the map after optional line assembly and
before `book.md`, `book.body.md`, review queues, and `score-documents/` are written, so
editable text and scoring use the same reordered document projection. Operational runs
can add `--require-reading-order-profile-safe` and
`--require-reading-order-profile-map-safe` to refuse unsafe profiles/maps. The book
wrapper now also treats a map audit as evidence for one exact map: supplied audits must
record the current map SHA-256, and `--require-reading-order-profile-map-safe` fails if
no `--reading-order-profile-map-audit` is supplied. `tools/audit_limbu_book_output.py`
now checks the profile-map hash, profile application report, assignments JSONL,
optional map audit, and per-page profile source documents, so stale profile-order
artifacts fail the normal book bundle audit.
|