code wiki / _hdl_build / nx_ocr_legibility_census.nx
nx_ocr_legibility_census.nx
buildroot/runtime/_hdl_build/nx_ocr_legibility_census.nx
about
nx_ocr_legibility_census.nx -- THE MECHANICAL LEGIBILITY JUDGE (operator 2026-07-03: "it should be an
ocr compare between what we generate and what chrome and bing do", replacing eyeball mockups).
Pipeline this scores: the SAME bench page (known ground truth) rendered by (a) OUR browser core at
100% + at 2x zoom (labeled), (b) Chrome headless, (c) Edge headless -- all read by the SAME neutral
OCR instrument (Windows.Media.Ocr; a 3rd-party MEASURING INSTRUMENT like qemu/openssl oracles, never
a runtime dependency). This organ is the SOVEREIGN SCORER: word-level RECALL (what fraction of the
ground-truth words the OCR recovered from the render = how much of the page a reader can actually
read) + F1, integer PERMILLE, SQuAD normalization (mirrors nx_qa_score's proven metric semantics:
lowercase, non-alnum->space, drop articles, multiset match).
HONESTY/TEETH: the verdict is HARNESS INTEGRITY, never the score -- C1 truth is substantial (>=25
tokens); C2 NEG/liar-kill: garbage text scores ~0 against the truth (metric can't be rigged); C3 all
four OCR files present (a missing incumbent row would silently inflate us); C4 report artifacts
written. The SCORES are printed raw, whatever they say. license_tier: ORIGINAL expect_exit: 0
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 17 | const K_MAGIC_16384: i64 = 16384 |
| 18 | const K_MAGIC_8192: i64 = 8192 |
| 19 | const K_MAGIC_2000: i64 = 2000 |
| 20 | const K_MAGIC_65536: i64 = 65536 |
| 21 | const K_MAGIC_1024: i64 = 1024 |
functions
| 23 | func oc_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 24 | func oc_num(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 } |
| 25 | func oc_app(buf: *u8, pos: i64, s: *u8) -> i64 { var p: i64=pos; var i: i64=0; while s[i]!=(0 as u8) { buf[p]=s[i]; p=p+1; i=i+1 } return p } called by 1: main |
| 26 | func oc_appd(buf: *u8, pos: i64, v: i64) -> i64 |
| 38 | func oc_write_file(path: *u8, data: *u8, n: i64) -> i64 |
| 46 | func oc_read(path: *u8, out: *u8, cap: i64) -> i64 |
| 60 | func oc_norm(src: *u8, dst: *u8) -> i64 called by 1: oc_score |
| 75 | func oc_is_article(buf: *u8, off: i64, len: i64) -> i64 called by 1: oc_tok |
| 81 | func oc_tok(buf: *u8, blen: i64, toff: *i64, tlen: *i64, maxn: i64) -> i64 |
| 100 | func oc_teq(pb: *u8, po: i64, pl: i64, gb: *u8, go: i64, gl: i64) -> i64 called by 1: oc_score |
| 107 | func oc_score(pred: *u8, gold: *u8, scores: *i64) -> i64 |
| 143 | func main() -> i64 |