nx_lib_semantic.nx
buildroot/runtime/nx_lib_semantic.nx
about
nx_lib_semantic.nx -- R3b-SCALE: run the sovereign distributional embedder over the REAL banked library
(the 6 deep-research dr_*.txt) so semantic retrieval goes LIVE on actual documents. Pipeline: read_file ->
tokenize (lowercase, len>=4 stopword floor) -> bounded vocab (V<=600) -> windowed word-word co-occurrence ->
doc vector = sum of member words' co-occ rows -> per-doc max-scale (cosine-invariant, bounds magnitude) ->
integer cosine. No float, no training, no dep. GATE asserts only STRUCTURAL invariants (self-sim=1000,
self-retrieval top-1, zero-query=0) so it CANNOT be gamed; the semantic CLUSTERING is MEASURED + REPORTED,
never pre-asserted (that would be the rigged-gate sin). HONEST CAP: first 3000 content-words/doc (logged).
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
| 10 | const K_MAGIC_3000: i64 = 3000 |
| 11 | const K_MAGIC_8388608: i64 = 8388608 |
| 12 | const K_MAGIC_65536: i64 = 65536 |
| 13 | const K_MAGIC_8192: i64 = 8192 |
| 14 | const K_MAGIC_200000: i64 = 200000 |
| 15 | const K_MAGIC_3200000: i64 = 3200000 |
functions
| 17 | func lw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 18 | func ln(v: i64) -> i64 { let bb: *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{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } |
| 20 | func read_file(path: *u8, buf: *u8, cap: i64, lenbox: *i64) -> i64 |
| 30 | func isqrt(n: i64) -> i64 called by 1: cos2 |
| 39 | func vdot(a: *i64, ao: i64, b: *i64, bo: i64, d: i64) -> i64 called by 1: cos2 |
| 46 | func cos2(a: *i64, ao: i64, b: *i64, bo: i64, d: i64) -> i64 |
| 58 | func vocab_id(vbuf: *u8, voff: *i64, vlen: *i64, vst: *i64, w: *u8, wl: i64, vmax: i64) -> i64 called by 1: tokenize_doc |
| 77 | func tokenize_doc(fb: *u8, flen: i64, d: i64, tok: *i64, MAXTOK: i64, ntok: *i64, vbuf: *u8, voff: *i64, vlen: *i64, vst: *i64, vmax: i64) -> i64 |
| 102 | func build_cooc(tok: *i64, d: i64, MAXTOK: i64, nt: i64, M: *i64, V: i64, W: i64) -> i64 called by 1: main |
| 119 | func build_dvec(tok: *i64, d: i64, MAXTOK: i64, nt: i64, M: *i64, V: i64, dvec: *i64, seen: *i64) -> i64 called by 1: main |
| 133 | func main() -> i64 |