code wiki / (root) / nx_qa_score.nx

nx_qa_score.nx

buildroot/runtime/nx_qa_score.nx

2707 B40 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_qa_score.nx -- KAT gate for the sovereign word-level F1 + Exact-Match scorer (the standard QA benchmark metric used by DeepResearcher (arXiv 2504.03160) / SQuAD / HotpotQA). The scoring functions now live in nx_qa_score_lib.nx (importable by benchmark harnesses); this file keeps the KAT + the negative control (a wrong answer MUST score 0 -- liar-kill on a rigged "always-full" metric). Integer/no-float, PERMILLE. license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_qa_score_lib.nx nx_qa_score.nx

imports: nx_qa_score_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main qw kat qs_f1 sys_mmap qs_norm qs_tok qs_is_article qs_common qs_tok_eq2 qs_em sys_mmap ↻ qs_norm ↻ qs_tok ↻ qs_tok_eq2 ↻ qw ↻ qn qn ↻

structs

none

consts

7const K_MAGIC_2000: i64 = 2000
8const K_MAGIC_4000: i64 = 4000

functions

10func qw(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 2: katmain
11func qn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m} 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 }
called by 2: katmain
13func kat(pred: *u8, gold: *u8, exp_f1: i64, exp_em: i64, tot: *i64) -> i64
called by 1: main calls 4: qs_f1qs_emqwqn
25func main() -> i64
calls 3: qwkatqn