code wiki / _hdl_build / nx_stem.nx
nx_stem.nx
buildroot/runtime/_hdl_build/nx_stem.nx
about
nx_stem.nx -- SOVEREIGN morphological stemming: FULL Porter (1980), the estate's ONE stemmer.
HISTORY: Step-1a-only -> PORTER-LITE 2026-07-03 (1a/1b/1c + a step-4 subset + -ly) -> FULL PORTER
2026-08-13 (all 5 steps, first-match-stops inside each step, the paper's suffix tables complete).
The gate's own HONEST line named "fuller Porter steps" as the extension; the trigger was
nx_beir_eval measuring our BM25 at nDCG@10 305 permil vs the stemmed Anserini baseline 320 --
its header named stemming as the gap.
CONSUMERS (grep-verified 2026-08-13, coverage_complete=1):
- nx_docportal_search_seg.nx: QUERY-TIME dictionary stem-expansion (both sides computed per
query, nothing persisted -> a stemmer upgrade shifts conflation keys CONSISTENTLY; the change
is DORMANT in the live daemon until its next rebuild -- RE-RUN THE MRR RULER on that rebuild).
- nx_stem_gate.nx (R-UX-2): every pre-upgrade vector verified to hold under full Porter.
- nx_beir_eval.nx: index+query tokenizer (the BEIR stemming rung).
HONEST SCOPE: no irregulars (children->child needs a lexicon). Buffer contract: step 1b can APPEND
one byte (-e restore) and nx_stem null-terminates, so out needs n+2 capacity.
exports: nx_stem (buffered) + vr_stem (in-place, backward-compat) + pst_stem (in-place core).
license_tier: ORIGINAL
dependencies 1 imports · 4 importers
imports: nx_syscalls.nx
imported by: nx_beir_eval.nxnx_docportal_search_seg.nxnx_stem_bound_gate.nxnx_stem_gate.nx
structs
| none |
consts
| none |
functions
| 22 | func pst_cons(b: *u8, i: i64) -> i64 |
| 37 | func pst_m(b: *u8, j: i64) -> i64 |
| 52 | func pst_vowelin(b: *u8, j: i64) -> i64 |
| 57 | func pst_doublec(b: *u8, j: i64) -> i64 |
| 63 | func pst_cvc(b: *u8, j: i64) -> i64 |
| 75 | func pst_ends(b: *u8, k: i64, s: *u8, sl: i64) -> i64 |
| 81 | func pst_set(b: *u8, js: i64, s: *u8, sl: i64) -> i64 |
| 87 | func pst_step1a(b: *u8, k: i64) -> i64 |
| 103 | func pst_step1b2(b: *u8, k: i64) -> i64 |
| 124 | func pst_step1b(b: *u8, k: i64) -> i64 |
| 145 | func pst_step1c(b: *u8, k: i64) -> i64 |
| 151 | func pst_step2(b: *u8, k: i64) -> i64 |
| 234 | func pst_step3(b: *u8, k: i64) -> i64 |
| 262 | func pst_step4(b: *u8, k: i64) -> i64 |
| 329 | func pst_step5a(b: *u8, k: i64) -> i64 |
| 336 | func pst_step5b(b: *u8, k: i64) -> i64 |
| 343 | func pst_stem(b: *u8, n: i64) -> i64 |
| 358 | func nx_stem(inp: *u8, n0: i64, out: *u8) -> i64 |
| 366 | func vr_stem(w: *u8, n: i64) -> i64 |