code wiki / _hdl_build / nx_pattern_emit_rankretrieve.nx

nx_pattern_emit_rankretrieve.nx

buildroot/runtime/_hdl_build/nx_pattern_emit_rankretrieve.nx

4319 B63 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind librarytopic pattern
docsdependenciesstructsconstsfunctions

about

nx_pattern_emit_rankretrieve.nx -- PATTERN EMITTER: RANK_RETRIEVE (shape 22). Authors a deterministic term-frequency RETRIEVAL core (the researcher's internal-arm shape): score each doc by occurrences of the query term, apply a BAKED relevance floor, return the top docid. The 2nd of the session's 5-emitter autonomy backlog -- now TEAM-AUTHORABLE hands-off (author=emitter, no Claude logic; faithful = returns -1 when nothing clears the floor, never fabricates). spec[0]=min_tf (1..16 relevance floor: a doc needs >= min_tf occurrences to count as a hit) Authored fn: <name>_retrieve(docs: *i64, dlens: *i64, ND: i64, term: *u8, tlen: i64, scores: *i64) -> i64 docs[i] = a *u8 text (stored as i64); returns the top docid (-1 if none clears the floor). EMIT-TIME RAILS: min_tf outside 1..16 -> spec REFUSED, nothing written. license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_pattern_emit_rankretrieve.n nx_pattern_emit_rankretrieve_demo.

imports: nx_syscalls.nx

imported by: nx_pattern_emit_rankretrieve_demo.nx

structs

none

consts

none

functions

12func prr_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd, s, n); return 0 }
13func prr_wn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m; sys_write(fd,"-" 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(fd,bb,k); return 0 }
called by 1: pe_rr_emit_core calls 2: sys_mmapsys_write
15func prr_spec_ok(spec: *i64) -> i64
called by 1: pe_rr_author
23func pe_rr_emit_core(fd: i64, name: *u8, spec: *i64) -> i64
called by 1: pe_rr_author calls 2: prr_wprr_wn
41func pe_rr_emit_test(fd: i64, name: *u8, spec: *i64) -> i64
56func pe_rr_author(name: *u8, modpath: *u8, testpath: *u8, spec: *i64) -> i64