code wiki / (root) / nx_dr_corpus.nx

nx_dr_corpus.nx source

↩ module page · 26 lines · 1457 B

1// nx_dr_corpus.nx -- FILE-BACKED corpus mode for the sovereign deep-research engine (DR-9). 2// The chain judged documents passed as argv strings, which caps a source at the argv limit -- 3// a real fetched web page (tens of KB) cannot ride there. This organ reads a source document 4// from DISK, so the engine runs over the corpus the live nx_fetch spine already writes 5// (knowledge/library/*.txt). That is the concrete unlock for a full-corpus benchmark run. 6// FAIL-LOUD BY CONSTRUCTION: an unreadable or empty source returns -1 so the caller REPORTS it 7// rather than silently scoring a missing file as zero coverage (a silent-truncation trap). 8// Composes nx_dr_chain (judge -> conduct -> score) and nx_dr_run (tokenizer). 9// Every func <=6 params (NAS nx_cc >6-arg skew, debt seq239). No hardware writes (Rule 26). 10// 11// module: nishi-core.research.dr_corpus 12// depends: nx_dr_chain.nx, nx_dr_run.nx, nx_syscalls.nx 13// genealogy_id: drbench_2026_corpus_scale 14import "nx_dr_chain.nx" 15import "nx_dr_run.nx" 16import "nx_syscalls.nx" 17 18// Read a sovereign corpus document from disk and tokenize it into out_ids. 19// Returns the token count, or -1 when the file is unreadable/empty (fail-loud). 20func corp_tokenize_file(path: *u8, out_ids: *i64, maxn: i64) -> i64 { 21 let lenp: *i64 = sys_mmap(8) as *i64 22 lenp[0] = 0 23 let buf: *u8 = sys_read_file(path, lenp) 24 if lenp[0] <= 0 { return 0 - 1 } 25 return drr_tokenize(buf, lenp[0], out_ids, maxn) 26}