code wiki / _hdl_build / nx_dr_semcorpus.nx

nx_dr_semcorpus.nx

buildroot/runtime/_hdl_build/nx_dr_semcorpus.nx

6660 B144 linesdepth 6pulls 8 transitivereach 0 importersview sourcekind tooltopic dr
docsdependenciesstructsconstsfunctions

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

nx_dr_semjudge.nx nx_json_emit.nx nx_syscalls.nx nx_dr_semcorpus.nx

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

main sc_kv_err je_puts sys_write je_q sys_mmap sys_write ↻ sys_exit sys_mmap ↻ sj_load ppl_load sys_openat_rd sys_mmap ↻ sys_read sys_close sc_readfile sys_openat_rd ↻ sys_read ↻ sys_close ↻ sj_tokenize_ids ppl_tokenize_ids ppl_wid_range sys_mmap ↻ db_bsearch_i64 db_semhash je_puts ↻ je_q ↻ je_num sys_mmap ↻ sys_write ↻ sj_maxsim ppl_maxsim ppl_dcos ppl_cos ppl_isqrt

structs

none

consts

20const K_MAGIC_262144: i64 = 262144
22const K_DBUF: i64 = 4194304
23const K_DTOK: i64 = 16384
24const K_INS: i64 = 1024
25const K_IPOOL: i64 = 65536
26const K_IBUF: i64 = 4194304

functions

29func sc_readfile(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
47func sc_kv_err(msg: *u8) -> i64
called by 1: main calls 2: je_putsje_q
52func main(argc: i64, argv: *i64) -> i64