nx_bright_prep.nx
buildroot/runtime/nx_bright_prep.nx
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
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
structs
| none |
consts
| 23 | const BP_OK: i64 = 0 |
| 24 | const BP_REFUSED: i64 = 1 |
| 25 | const BP_USAGE: i64 = 2 |
| 26 | const BP_STDOUT: i64 = 1 |
| 27 | const BP_MODE_DIR: i64 = 0x1ed |
| 28 | const BP_PATH_CAP: i64 = 1024 |
| 29 | const BP_SLASH: i64 = 47 |
| 30 | const BP_TMP: *u8 = ".tmp" |
| 31 | const BP_F_CORPUS: *u8 = "/corpus.tsv" |
| 32 | const BP_F_QUERIES: *u8 = "/queries.tsv" |
| 33 | const BP_D_QRELS: *u8 = "/qrels" |
| 34 | const BP_F_QRELS: *u8 = "/qrels/test.tsv" |
| 35 | const BP_F_EXCLUDED: *u8 = "/excluded.tsv" |
| 36 | const BP_F_LICENSE: *u8 = "/LICENSE" |
| 37 | const BP_COL_ID: *u8 = "id" |
| 38 | const BP_COL_CONTENT: *u8 = "content" |
| 39 | const BP_COL_QUERY: *u8 = "query" |
| 40 | const BP_COL_GOLD: *u8 = "gold_ids" |
| 41 | const BP_COL_EXCL: *u8 = "excluded_ids" |
| 42 | const BP_H1: *u8 = "query-id" |
| 43 | const BP_H2: *u8 = "corpus-id" |
| 44 | const BP_H3: *u8 = "score" |
| 45 | const BP_SCORE: *u8 = "1" |
| 46 | const 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." |
| 48 | const BR_QUERIES: i64 = 0 |
| 49 | const BR_NULLQ: i64 = 1 |
| 50 | const BR_QDECL: i64 = 2 |
| 51 | const BR_QRELS: i64 = 3 |
| 52 | const BR_EXCL: i64 = 4 |
| 53 | const BR_ORPHANS: i64 = 5 |
| 54 | const BR_CORPUS_DECL: i64 = 6 |
| 55 | const BR_CORPUS_ROWS: i64 = 7 |
| 56 | const BR_CORPUS_WRITTEN: i64 = 8 |
| 57 | const BR_CORPUS_NULL: i64 = 9 |
| 58 | const BR_CORPUS_BYTES: i64 = 10 |
| 59 | const BR_STAGE: i64 = 11 // which stage refused (BR_ST_*), 0 when none |
| 60 | const BR_WHAT: i64 = 12 // the reader's pq[PQ_WHAT] at the refusal |
| 61 | const BR_SLOTS: i64 = 13 |
| 63 | const BR_ST_NONE: i64 = 0 |
| 64 | const BR_ST_LICENSE: i64 = 1 |
| 65 | const BR_ST_DOCS_OPEN: i64 = 2 |
| 66 | const BR_ST_DOCS_COLUMNS: i64 = 3 |
| 67 | const BR_ST_CORPUS: i64 = 4 |
| 68 | const BR_ST_EX_OPEN: i64 = 5 |
| 69 | const BR_ST_EX_COLUMNS: i64 = 6 |
| 70 | const BR_ST_OUTPUTS: i64 = 7 |
| 71 | const BR_ST_EX_READ: i64 = 8 |
| 72 | const BR_ST_ROWS: i64 = 9 |
| 73 | const BR_ST_FINISH: i64 = 10 |
functions
| 75 | func bp_slen(s: *u8) -> i64 |
| 81 | func bp_path(dst: *u8, base: *u8, tail: *u8) -> i64 |
| 93 | func bp_parent(dst: *u8, path: *u8) -> i64 |
| 105 | func bp_open_tmp(path: *u8, tmp: *u8) -> i64 |
| 111 | func bp_finish(w: *i64, fd: i64, tmp: *u8, path: *u8) -> i64 |
| 118 | func bp_stage_name(st: i64) -> *u8 called by 1: main |
| 132 | func bp_run(exf: *u8, docf: *u8, outdir: *u8, st: *i64) -> i64 |
| 289 | func bp_verdict(st: *i64) -> i64 |
| 296 | func main(argc: i64, argv: *i64) -> i64 |