code wiki / _hdl_build / nx_ocr_legibility_census.nx

nx_ocr_legibility_census.nx

buildroot/runtime/_hdl_build/nx_ocr_legibility_census.nx

12358 B209 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic ocr
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_ocr_legibility_census.nx

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

main oc_puts sys_write sys_mmap oc_read sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close oc_score sys_mmap ↻ oc_norm oc_tok oc_is_article oc_teq oc_num sys_mmap ↻ sys_write ↻ oc_app oc_appd sys_mmap ↻ oc_write_file sys_openat_wr sys_write ↻ sys_close ↻ sys_exit

structs

none

consts

17const K_MAGIC_16384: i64 = 16384
18const K_MAGIC_8192: i64 = 8192
19const K_MAGIC_2000: i64 = 2000
20const K_MAGIC_65536: i64 = 65536
21const K_MAGIC_1024: i64 = 1024

functions

23func 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 }
called by 1: main calls 1: sys_write
24func 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 }
called by 1: main calls 2: sys_mmapsys_write
25func 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
26func oc_appd(buf: *u8, pos: i64, v: i64) -> i64
called by 1: main calls 1: sys_mmap
38func oc_write_file(path: *u8, data: *u8, n: i64) -> i64
46func oc_read(path: *u8, out: *u8, cap: i64) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
60func oc_norm(src: *u8, dst: *u8) -> i64
called by 1: oc_score
75func oc_is_article(buf: *u8, off: i64, len: i64) -> i64
called by 1: oc_tok
81func oc_tok(buf: *u8, blen: i64, toff: *i64, tlen: *i64, maxn: i64) -> i64
called by 1: oc_score calls 1: oc_is_article
100func oc_teq(pb: *u8, po: i64, pl: i64, gb: *u8, go: i64, gl: i64) -> i64
called by 1: oc_score
107func oc_score(pred: *u8, gold: *u8, scores: *i64) -> i64
called by 1: main calls 4: sys_mmapoc_normoc_tokoc_teq
143func main() -> i64