code wiki / (root) / nx_didyoumean_gate.nx

nx_didyoumean_gate.nx

buildroot/runtime/nx_didyoumean_gate.nx

23152 B394 linesdepth 6pulls 15 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

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

nx_docportal_search_seg.nx nx_docportal_search_serve.nx nx_gate_verdict.nx nx_didyoumean_gate.nx

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

main gv_ctr 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 ↻ gv_head gv_puts sys_write ↻ gv_check_eq gv_check gv_puts ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap dym_edits_allowed dym_lookup_bound dym_edits_allowed ↻ dym_letters dym_mid dym_rare idf_q10 ilog2_1024 dym_rare ↻ dym_common dym_rare ↻ gv_check ↻

structs

none

consts

22const DG_SP: i64 = 32
23const DG_COLON: i64 = 58
24const DG_PLANTED_BAR: i64 = 9 // the rung's done-rule: at least 9 of the 10 planted misspellings corrected
25const DG_CONTROL_N: i64 = 10 // the rung's done-rule: a control of 10 rare, correctly spelled terms
26const DG_ROOT: i64 = 1000 // the midpoint KAT: a corpus of ROOT*ROOT - 1 documents has an exact midpoint of ROOT
27const DG_SMALL_N: i64 = 3 // the midpoint KAT on a three-document fixture: sqrt(3 + 1) = 2
28const DG_SMALL_MID: i64 = 2
29const DG_MID_TOL: i64 = 2 // the Q10 log truncates, so the found boundary may sit a df or two past the exact root
30const DG_SEVEN: i64 = 7 // the envelope KAT length (recieve)
31const DG_SEVEN_BOUND: i64 = 343 // 6 deletions + 5 swaps + 25x6 substitutions + 26x7 insertions, counted by hand
32const DG_PLANTED: *u8 = "recieve:receive definately:definitely seperate:separate occured:occurred untill:until goverment:government enviroment:environment neccessary:necessary accomodate:accommodate beleive:believe"
33const DG_RESERVE: *u8 = "quokka zeugma petrichor anhedonia apophenia limerence borborygmus kakistocracy defenestration sesquipedalian susurrus apricity hiraeth vellichor lalochezia ultracrepidarian tsundoku psithurism crepuscular gnomon"
34const DG_HELDOUT: *u8 = "acheive:achieve arguement:argument begining:beginning commited:committed existance:existence foriegn:foreign grammer:grammar independant:independent recomend:recommend succesful:successful"
35const DG_SHORT: *u8 = "yurt sumac quoll okapi dhole sonder kelpie jicama"
36const DG_MULTI: *u8 = "recieve definately seperate occured untill goverment enviroment neccessary accomodate beleive"
37const DG_E2E_Q: *u8 = "Recieve the package"
38const DG_E2E_WANT: *u8 = "receive the package"
39const DG_OP_Q: *u8 = "site:reddit.com recieve"
40const DG_OP_WANT: *u8 = "site:reddit.com receive"
41const DG_COMMON_W: *u8 = "receive"
42const DG_FIRST_W: *u8 = "uantum"
43const DG_FIRST_NOT: *u8 = "quantum"
44const DG_TWO_W: *u8 = "zq"
45const DG_SERVE_DOM: *u8 = "nishifamily.com" // the site domain the served handler is asked as; scope=web sends it to the web shard
46const DG_MEMO_Q: *u8 = "RECIEVE the Package" // a case variant of DG_E2E_Q: the memo key folds case, so it must hit
47const DG_MEMO_OTHER: *u8 = "recieve the parcel" // a different query: the key must discriminate, so it must miss

functions

49func dg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: dg_containsmain
50func dg_eq(a: *u8, an: i64, b: *u8, bn: i64) -> i64
called by 1: main
56func dg_contains(b: *u8, n: i64, pat: *u8) -> i64
called by 1: main calls 1: dg_len
72func dg_field(list: *u8, k: i64, p: i64, out: *u8) -> i64
called by 1: main
111func dg_row(panel: *u8, w: *u8, wl: i64, tdf: i64, got: *u8, gl: i64, st: *i64, tag: *u8) -> i64
called by 1: main calls 2: gv_putsgv_num
124func main(argc: i64, argv: *i64) -> i64