nx_didyoumean_gate.nx
buildroot/runtime/nx_didyoumean_gate.nx
about
nx_didyoumean_gate.nx -- GATE for SEARCH RUNG F4, the did-you-mean line (nx_didyoumean + the seg's contract symbol
dss_spell_suggest), judged on the LIVE term dictionary of the public web shard.
PRE-DECLARED BEFORE THE FIRST RUN (the rung's own done-rule, 2026-09-18): a planted set of 10 misspellings corrects at
least 9 to the intended word, while a control of 10 correctly spelled RARE terms draws no suggestion.
- THE PLANTED SET is ten entries of the published common-misspelling lists, chosen to span the four one-edit mechanisms
(two swaps, two substitutions, four insertions, two deletions) and for nothing else.
- THE CONTROL is the first ten words of a pre-declared, ordered reserve of real English words that the live dictionary
HOLDS and rates RARE by the same midpoint the suggester uses -- selected by document frequency alone, never by what
the suggester does with them. If fewer than ten qualify, the control is not the population the rule names and the
gate says SKIP rather than guess.
- TWO PANELS PRINT AND DO NOT VOTE: ten more common misspellings (held out: nothing was tuned on them) and eight short
rare words, the class the lib's documented imprecision is about. Their counts ride the values block, so a change in
either is visible without being dressed as a verdict.
The arithmetic (the majority rule, the midpoint, the lookup envelope) is pinned before the live dictionary judges
anything, and every live row prints its document frequencies, its lookups and its microseconds.
license_tier: ORIGINAL No hw writes (Rule 26). Read-only on the shard.
dependencies 3 imports · 0 importers
imports: nx_docportal_search_seg.nxnx_docportal_search_serve.nxnx_gate_verdict.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 22 | const DG_SP: i64 = 32 |
| 23 | const DG_COLON: i64 = 58 |
| 24 | const DG_PLANTED_BAR: i64 = 9 // the rung's done-rule: at least 9 of the 10 planted misspellings corrected |
| 25 | const DG_CONTROL_N: i64 = 10 // the rung's done-rule: a control of 10 rare, correctly spelled terms |
| 26 | const DG_ROOT: i64 = 1000 // the midpoint KAT: a corpus of ROOT*ROOT - 1 documents has an exact midpoint of ROOT |
| 27 | const DG_SMALL_N: i64 = 3 // the midpoint KAT on a three-document fixture: sqrt(3 + 1) = 2 |
| 28 | const DG_SMALL_MID: i64 = 2 |
| 29 | const DG_MID_TOL: i64 = 2 // the Q10 log truncates, so the found boundary may sit a df or two past the exact root |
| 30 | const DG_SEVEN: i64 = 7 // the envelope KAT length (recieve) |
| 31 | const DG_SEVEN_BOUND: i64 = 343 // 6 deletions + 5 swaps + 25x6 substitutions + 26x7 insertions, counted by hand |
| 32 | const DG_PLANTED: *u8 = "recieve:receive definately:definitely seperate:separate occured:occurred untill:until goverment:government enviroment:environment neccessary:necessary accomodate:accommodate beleive:believe" |
| 33 | const DG_RESERVE: *u8 = "quokka zeugma petrichor anhedonia apophenia limerence borborygmus kakistocracy defenestration sesquipedalian susurrus apricity hiraeth vellichor lalochezia ultracrepidarian tsundoku psithurism crepuscular gnomon" |
| 34 | const DG_HELDOUT: *u8 = "acheive:achieve arguement:argument begining:beginning commited:committed existance:existence foriegn:foreign grammer:grammar independant:independent recomend:recommend succesful:successful" |
| 35 | const DG_SHORT: *u8 = "yurt sumac quoll okapi dhole sonder kelpie jicama" |
| 36 | const DG_MULTI: *u8 = "recieve definately seperate occured untill goverment enviroment neccessary accomodate beleive" |
| 37 | const DG_E2E_Q: *u8 = "Recieve the package" |
| 38 | const DG_E2E_WANT: *u8 = "receive the package" |
| 39 | const DG_OP_Q: *u8 = "site:reddit.com recieve" |
| 40 | const DG_OP_WANT: *u8 = "site:reddit.com receive" |
| 41 | const DG_COMMON_W: *u8 = "receive" |
| 42 | const DG_FIRST_W: *u8 = "uantum" |
| 43 | const DG_FIRST_NOT: *u8 = "quantum" |
| 44 | const DG_TWO_W: *u8 = "zq" |
| 45 | const DG_SERVE_DOM: *u8 = "nishifamily.com" // the site domain the served handler is asked as; scope=web sends it to the web shard |
| 46 | const DG_MEMO_Q: *u8 = "RECIEVE the Package" // a case variant of DG_E2E_Q: the memo key folds case, so it must hit |
| 47 | const DG_MEMO_OTHER: *u8 = "recieve the parcel" // a different query: the key must discriminate, so it must miss |
functions
| 49 | func dg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 50 | func dg_eq(a: *u8, an: i64, b: *u8, bn: i64) -> i64 called by 1: main |
| 56 | func dg_contains(b: *u8, n: i64, pat: *u8) -> i64 |
| 72 | func dg_field(list: *u8, k: i64, p: i64, out: *u8) -> i64 called by 1: main |
| 111 | func dg_row(panel: *u8, w: *u8, wl: i64, tdf: i64, got: *u8, gl: i64, st: *i64, tag: *u8) -> i64 |
| 124 | func main(argc: i64, argv: *i64) -> i64 |