code wiki / (root) / nx_bright_prep.nx

nx_bright_prep.nx

buildroot/runtime/nx_bright_prep.nx

15543 B346 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind tooltopic bright
docsdependenciesstructsconstsfunctions

about

nx_bright_prep.nx -- BRIGHT (huggingface xlangai/BRIGHT, cc-by-4.0) reshaped into the BEIR layout nx_beir_eval reads (search R0d be_bright). usage: nx_bright_prep <split> <examples.parquet> <documents.parquet> <outdir> Writes, through the sovereign parquet reader (nx_parquet_lib): <outdir>/corpus.tsv doc id TAB content (the documents file, id and content, via pq_tsv) <outdir>/queries.tsv query id TAB query (the examples file) <outdir>/qrels/test.tsv the BEIR header line, then query id TAB doc id TAB 1 for every gold_ids element <outdir>/excluded.tsv query id TAB doc id for every excluded_ids element: BRIGHT lists the query's own source documents there, so a retriever must not be credited for finding them <outdir>/../LICENSE the dataset, its source and its licence beside the bytes (a data asset carries its licence in the same directory, the estate's rule for foreign data) Every file is staged as .tmp and renamed into place. Tabs, newlines and carriage returns inside a cell become spaces. A row with a null id or query is COUNTED and skipped; a gold or excluded element whose row has no id is COUNTED as an orphan. The known-answer test is the dataset card's num_examples per split (search.refs brightds26): queries must equal it and corpus rows must equal the documents count. The work lives in bp_run so the gate drives it in-process; main prints the receipt. Exit 0 OK, 1 REFUSED, 2 usage. Measured 2026-09-14 on eleven splits: every count agrees with the card, orphans 0 (search.plan 1789433620). license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_parquet_lib.nx nx_bright_prep.nx nx_bright_prep_gate.nx

imports: nx_syscalls.nxnx_parquet_lib.nx

imported by: nx_bright_prep_gate.nx

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

main wb_new sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ wb_puts wb_byte wb_flush sys_write ↻ wb_byte ↻ wb_flush ↻ sys_exit ↻ sys_mmap ↻ bp_run sys_mmap ↻ bp_parent bp_slen sys_mkdir bp_path bp_slen ↻ bp_open_tmp bp_path ↻ sys_openat_wr wb_new ↻ wb_puts ↻ wb_byte ↻ bp_finish wb_flush ↻

structs

none

consts

23const BP_OK: i64 = 0
24const BP_REFUSED: i64 = 1
25const BP_USAGE: i64 = 2
26const BP_STDOUT: i64 = 1
27const BP_MODE_DIR: i64 = 0x1ed
28const BP_PATH_CAP: i64 = 1024
29const BP_SLASH: i64 = 47
30const BP_TMP: *u8 = ".tmp"
31const BP_F_CORPUS: *u8 = "/corpus.tsv"
32const BP_F_QUERIES: *u8 = "/queries.tsv"
33const BP_D_QRELS: *u8 = "/qrels"
34const BP_F_QRELS: *u8 = "/qrels/test.tsv"
35const BP_F_EXCLUDED: *u8 = "/excluded.tsv"
36const BP_F_LICENSE: *u8 = "/LICENSE"
37const BP_COL_ID: *u8 = "id"
38const BP_COL_CONTENT: *u8 = "content"
39const BP_COL_QUERY: *u8 = "query"
40const BP_COL_GOLD: *u8 = "gold_ids"
41const BP_COL_EXCL: *u8 = "excluded_ids"
42const BP_H1: *u8 = "query-id"
43const BP_H2: *u8 = "corpus-id"
44const BP_H3: *u8 = "score"
45const BP_SCORE: *u8 = "1"
46const BP_LICENSE_TEXT: *u8 = "BRIGHT: A Realistic and Challenging Benchmark for Reasoning-Intensive Retrieval. Source: huggingface.co/datasets/xlangai/BRIGHT (the dataset card is pinned as search.refs brightds26, read 2026-09-14). Licence: Creative Commons Attribution 4.0 (cc-by-4.0), as declared on that card. The files under this directory are derived from the documents and examples parquet files of that dataset by the estate's own reader (nx_parquet_lib) and prep organ (nx_bright_prep), reshaped into the BEIR layout nx_beir_eval reads (corpus.tsv, queries.tsv, qrels/test.tsv, excluded.tsv per split); content is unchanged apart from tabs, newlines and carriage returns inside a cell becoming spaces. This file is written by nx_bright_prep on every run."
48const BR_QUERIES: i64 = 0
49const BR_NULLQ: i64 = 1
50const BR_QDECL: i64 = 2
51const BR_QRELS: i64 = 3
52const BR_EXCL: i64 = 4
53const BR_ORPHANS: i64 = 5
54const BR_CORPUS_DECL: i64 = 6
55const BR_CORPUS_ROWS: i64 = 7
56const BR_CORPUS_WRITTEN: i64 = 8
57const BR_CORPUS_NULL: i64 = 9
58const BR_CORPUS_BYTES: i64 = 10
59const BR_STAGE: i64 = 11 // which stage refused (BR_ST_*), 0 when none
60const BR_WHAT: i64 = 12 // the reader's pq[PQ_WHAT] at the refusal
61const BR_SLOTS: i64 = 13
63const BR_ST_NONE: i64 = 0
64const BR_ST_LICENSE: i64 = 1
65const BR_ST_DOCS_OPEN: i64 = 2
66const BR_ST_DOCS_COLUMNS: i64 = 3
67const BR_ST_CORPUS: i64 = 4
68const BR_ST_EX_OPEN: i64 = 5
69const BR_ST_EX_COLUMNS: i64 = 6
70const BR_ST_OUTPUTS: i64 = 7
71const BR_ST_EX_READ: i64 = 8
72const BR_ST_ROWS: i64 = 9
73const BR_ST_FINISH: i64 = 10

functions

75func bp_slen(s: *u8) -> i64
called by 2: bp_pathbp_parent
81func bp_path(dst: *u8, base: *u8, tail: *u8) -> i64
called by 2: bp_open_tmpbp_run calls 1: bp_slen
93func bp_parent(dst: *u8, path: *u8) -> i64
called by 1: bp_run calls 1: bp_slen
105func bp_open_tmp(path: *u8, tmp: *u8) -> i64
called by 1: bp_run calls 2: bp_pathsys_openat_wr
111func bp_finish(w: *i64, fd: i64, tmp: *u8, path: *u8) -> i64
118func bp_stage_name(st: i64) -> *u8
called by 1: main
132func bp_run(exf: *u8, docf: *u8, outdir: *u8, st: *i64) -> i64
289func bp_verdict(st: *i64) -> i64
called by 2: mainmain
296func main(argc: i64, argv: *i64) -> i64