code wiki / _hdl_build / nx_dr_semcorpus.nx
nx_dr_semcorpus.nx
buildroot/runtime/_hdl_build/nx_dr_semcorpus.nx
about
nx_dr_semcorpus.nx -- BATCH semantic judge (the at-scale enabler; eats the model-reload debt).
nx_dr_semjudge_cli reloads the 41MB PPMI model per PROCESS: a 16-doc x 81-insight run
reloaded it 16x = ~21 min, ALL of it model-load. This loads the model ONCE and scores MANY
doc FILES against a SHARED insight set, so a full-corpus judge is no longer reload-bound.
Behaviour-preserving BY COMPOSITION: it calls the SAME sj_load/sj_tokenize_ids/sj_maxsim
(=> nx_ppmi_lib) as nx_dr_semjudge, so per (doc,insight) semantic_permil is bit-identical to
the per-call judge -- the gate proves that against the live incumbent, not by assertion.
nx_dr_semcorpus <insights_file (one insight per line)> <doc_file_1> [doc_file_2 ...]
-> {"tool":"nx_dr_semcorpus","vocab":V,"n_insights":K,"docs":[
{"doc":0,"readable":1,"tokens":N,"scores":[s0,..,sK-1]}, ...]}
An unreadable doc reports readable:0 (fail-loud), never a silent all-zero row.
Every func <=6 params (NAS nx_cc >6-arg skew, seq239). No hardware writes (Rule 26).
license_tier: ORIGINAL expect_exit: 0
module: nishi-core.research.dr_semcorpus depends: nx_dr_semjudge.nx
v3 (OO tranche 1): local sc_puts/sc_q/sc_num DELETED -> the canonical nx_json_emit lib.
Migration is BYTE-EXACT gated (same inputs, identical output bytes) -- zero lost function.
dependencies 3 imports · 0 importers
imports: nx_dr_semjudge.nxnx_json_emit.nxnx_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
| 20 | const K_MAGIC_262144: i64 = 262144 |
| 22 | const K_DBUF: i64 = 4194304 |
| 23 | const K_DTOK: i64 = 16384 |
| 24 | const K_INS: i64 = 1024 |
| 25 | const K_IPOOL: i64 = 65536 |
| 26 | const K_IBUF: i64 = 4194304 |
functions
| 29 | func sc_readfile(path: *u8, buf: *u8, cap: i64) -> i64 |
| 47 | func sc_kv_err(msg: *u8) -> i64 |
| 52 | func main(argc: i64, argv: *i64) -> i64 |