ocr-projects-archive / ocr-tech-mps-integration /docs /SUNUWAR_CONVERTER_STATUS.md
prosperious's picture
Add 1000 files (ocr-tech/tests/test_audit_limbu_book_missed_line_review_coverage.py ...)
d82db76 verified
|
Raw History Blame Contribute Delete
7.91 kB
# Sikkim Herald Sunuwar (Jenticha / Koĩts) → Unicode: converter status
**Verdict: no faithful legacy → Unicode converter is derivable from currently
available resources.** Raw legacy spans + per-line bounding boxes are extracted
and saved; the Unicode ground-truth side of an OCR eval pack is blocked. This is
the opposite outcome to Kirat Rai / Limbu, where SIL published a usable TECkit
map. The reasons below are concrete and verifiable; the mapping was **not
fabricated**.
## Target
- Script: Sunuwar alphabet (formerly Jenticha, autonym Koĩts / Kõits).
- Unicode block: **U+11BC0–U+11BFF** (added in Unicode 16.0, Sept 2024).
- Target font present in repo: `data/fonts/himalayan-scripts/NotoSansSunuwar-Regular.ttf`
(44 block codepoints, descriptive glyph names like `devisunuwar`).
## PDFs acquired
The Sunuwar edition of the Sikkim Herald is published under the masthead name
**"Mukhia"**. Three editions downloaded to `data/sikkim-herald/sunuwar/`:
| File | Pages | Sunuwar font(s) |
|------|-------|-----------------|
| `mukhia_2021-07-16.pdf` | 5 | `CIDFont+F2` (BaseFont **`koits`**) — subsetted CID, Identity-H |
| `mukhia_2023-08-15.pdf` | 4 | `BKBKDF+kirat1` — byte-encoded TrueType, WinAnsi |
| `mukhia_2024-09-02.pdf` | 4 | `JKLNDK+kirat1` — byte-encoded TrueType, WinAnsi |
Source: `www.sikkim.gov.in/uploads/SikkimHerald/`.
## Font characterization
- **The visible script is genuinely Jenticha/Sunuwar** (confirmed by rendering
page images — the masthead and body are the angular Koĩts letterforms, *not*
Devanagari).
- The script content is stored as a **legacy Latin byte stream** in a display
font. Extracted text for every edition is pure ASCII (U+0020–U+007D); the byte
`a` renders as a Sunuwar glyph but is stored as Latin `a`.
- 2023/2024: font `kirat1`, WinAnsi byte encoding, no ToUnicode → bytes are the
raw stream directly.
- 2021: subsetted CID fonts with `Identity-H` + a ToUnicode CMap, but the
**ToUnicode maps CIDs straight back to ASCII** (CID `0x44` → U+0061 'a', …),
so the extractable "Unicode" is still just the legacy Latin byte stream.
- **`post` tables expose no Sunuwar mapping.** The embedded `koits`/`kirat1`
fonts are `post` **format 3.0** (no glyph names at all). Every recoverable
glyph name is a standard Adobe-Glyph-List Latin/punct name (`a`, `comma`,
`zero`, …). There is zero Sunuwar-descriptive glyph naming. The
`post`-table-glyph-name route — the most promising lead per the task brief —
yields nothing.
Raw deduped span stats (shadow/bold layers collapsed by rounded bbox, same as
the Kirat Rai tool): **1,403 spans, 18,135 non-space legacy bytes, 61 distinct
bytes.** Dominant non-letter bytes: `{ } | O = /` — these are the vowel-sign /
medial-consonant bytes.
## Mapping hunt — every avenue tried
1. **SIL `silnrsi/wsresources`** — full recursive tree scanned (1,902 entries).
Script dirs include `Krai` (Kirat Rai, used by the sibling) and `Limb`, but
**no `Sunu` / Sunuwar / Jenticha / koits / mukhia** path exists. No TECkit map.
2. **`ScriptEncodingInitiative/sunuwar`** — exists, but contains only the Noto
font design (Glyphs source) + QA tests. No legacy mapping / TECkit / `.tec`.
3. **Embedded-font glyph names / cmap** — format 3.0, AGL-Latin only (see above).
Nothing.
4. **Koĩts "languagetools" web converter**
(`languagetools-153419.appspot.com/suz/`) — this *does* exist and converts
`Mukdum`/`kirat1`/`kirat2`/`Preeti` → Unicode. Its mapping table
(`/js/suzConverter.js`, archived at
`data/mappings/sunuwar-legacy/koits_languagetools_suzConverter.js`) was parsed.
**It is not usable as a faithful converter for these PDFs:**
- The table's `private_use_map_combined` has three columns. Column 2 (the only
"→ Unicode Sunuwar" column) is keyed to the **`Mukdum` keyboard layout**.
- The Herald `kirat1` byte→glyph assignment matches the table's **column 1
(`\uedXX` "Jenticha" PUA)**, a *different* layout. The two layouts disagree
on which byte produces which glyph.
- Applying column 2 to the Herald byte stream maps only **59% of bytes** into
the Sunuwar block and leaves **34% unmapped** — and the unmapped residue is
exactly the vowel/medial bytes (`{`×1868, `}`×1294, `|`×1079, `O`×964, …,
~5,300 occurrences) that are essential to legible Sunuwar.
- A per-glyph **visual** check (render the Herald byte string in the legacy
font vs. the column-2 Unicode in Noto Sans Sunuwar) gives a render
similarity of only ~0.30 — the converted letters do not match the source
glyphs. Column 2 is the wrong layout *and* incomplete.
5. **Public `kirat1_PUA_new.ttf` (from languagetools)** — downloaded to try a
Herald-byte → PUA → Unicode chain. Rejected: its glyphs are **completely
different** from the Herald embedded `kirat1` (per-byte outline similarity
~0.05–0.20), and its glyph names are Cyrillic-AFII (`afii10023`, `Gcedilla`,
…) — it is a repurposed Cyrillic font shell with a different byte layout.
6. **Outline / raster matching (Herald glyph → nearest Noto Sunuwar glyph)** —
attempted as a last-resort shape-grounded derivation. **Reliable only for
visually-distinct glyphs** (digits 0–9 match their correct codepoint, scores
0.80–0.98). For letters it is too noisy to trust: Sunuwar letters are mutually
similar, so multiple distinct bytes (`s`, `z`, `{`) all "best-match" the same
codepoint (IMAR). It cross-validates the digits but **cannot faithfully
resolve the letter/vowel layer**, so it is not used to assert a table.
## Why the mapping was not fabricated
A byte→Unicode table good enough to look plausible could be hand-assembled by
mixing column 2 + raster guesses, but it would be wrong for the vowel/medial
layer and for several letters, producing corrupt "Unicode" GT. Per the task's
explicit instruction, no such table is written. The honest blocker is: **the
Herald uses the Jenticha/`kirat1` keyboard layout, and no public source
documents that layout's byte→Unicode correspondence** (only the Mukdum layout is
published, partially).
## What IS delivered
- `data/sikkim-herald/sunuwar/*.pdf` — 3 editions.
- `data/real-text/sikkim-herald/sunuwar.raw_spans.json` — 1,403 deduped spans
with page, bbox, font, size, `raw_legacy_text`, `unicode_text: null`, plus full
byte-frequency + font characterization.
- `data/real-text/sikkim-herald/sunuwar.raw_legacy.txt` — raw legacy text.
- `data/mappings/sunuwar-legacy/` — archived languagetools JS + parsed partial
column-2 table, both clearly labelled PARTIAL / WRONG-LAYOUT (evidence only).
- `data/sikkim-herald/sunuwar/_evalpack_demo/` — 5 demo line crops (300 dpi) +
manifest, proving the **image** side of an eval pack is feasible.
- `tools/extract_sikkim_herald_sunuwar.py` — the raw extractor.
## Eval-pack verdict
- **Image side: feasible.** PyMuPDF per-line bboxes crop cleanly; the embedded
font renders the correct Jenticha glyphs. **1,206 clean line-candidate spans**
(width > 40 pt, ≥ 6 non-space bytes) across the 3 editions.
- **Ground-truth side: BLOCKED.** Without a faithful byte→Unicode converter there
is no trustworthy Unicode GT, so a usable OCR validation pack cannot be built
from these PDFs today.
## Paths to unblock (future work)
1. Obtain the **`kirat1`/Jenticha keyboard's** byte→Unicode table directly from
the Koĩts community / Sikkim IPR (the people who typeset the Herald), or a
Keyman `.kmn` for that exact layout.
2. Manually transcribe a small Herald passage to Unicode (a Sunuwar reader) and
solve the byte→codepoint table by alignment — then it is faithful and the full
corpus + eval pack unlock.
3. Use the renderable line crops as **unlabeled** images for self-supervised /
transfer pretraining only, never as labeled GT.