code wiki / (root) / nx_writestyle.nx

nx_writestyle.nx

buildroot/runtime/nx_writestyle.nx

6824 B164 linesdepth 1pulls 1 transitivereach 10 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_writestyle.nx -- WRITING arc, rung W-R1: the content-agnostic prose-SIGNAL detector. Extends W-R0 (nx_writecraft) with the craft signals an editor flags, computed deterministically so they are exact + reproducible + exceed-able vs Hemingway Editor / ProWritingAid (highlights -> here, quantitative counts). CONTENT-AGNOSTIC by design: it scores any register (the SFW lane and the operator's local-LLM explicit lane run the SAME organ). The dialogue ratio + these signals also feed the register classifier / routing seam and the companion + image-gen ingestion point (per the 2026-06-12 fiction-ingestion spec). No register lexicon lives here -- that arrives later as DATA (rule 25), operator/lane-provided, never hardcoded. Signals (out[], filled by ws_signals): out[0] = adverbs -- words ending "-ly" (len >= WS_ADVERB_MINLEN) out[1] = passive -- a be-verb followed within WS_PASS_WINDOW words by an "-ed" word (one per be-verb) out[2] = weak -- intensifier/filler words (data list below) out[3] = dialogue_milli -- chars inside double-quotes * 1000 / total chars out[4] = longest_sentence -- words in the longest sentence out[5] = hard_sentences -- sentences with >= WS_HARD_SENT_WORDS words out[6], out[7] -- SCRATCH (be-verb window, current-sentence words) -- caller must allocate out with >= 8 i64. returns out[0] (adverb count). A word can satisfy more than one signal ("really" = adverb AND weak); that is intentional. Thresholds are heuristic consts (move to conf/store as DATA next). Pure integer, NO syscalls. Reuses nx_writecraft for char classification (DRY). license_tier: ORIGINAL module: nishi-core.write.style depends: nishi-core.write.craft capability: WRITE_PROSE_SIGNALS

dependencies 1 imports · 4 importers

nx_writecraft.nx nx_writestyle.nx nx_tone.nx nx_write_exceed_gate.nx nx_writehub_score.nx nx_writestyle_gate.nx

imports: nx_writecraft.nx

imported by: nx_tone.nxnx_write_exceed_gate.nxnx_writehub_score.nxnx_writestyle_gate.nx

structs

none

consts

36const WS_ADVERB_MINLEN: i64 = 4
37const WS_PASS_WINDOW: i64 = 3
38const WS_HARD_SENT_WORDS: i64 = 14

functions

41func ws_streq_ci(t: *u8, a: i64, b: i64, lit: *u8) -> i64
called by 2: ws_is_beverbws_is_weak calls 1: wc_lower
55func ws_ends2(t: *u8, a: i64, b: i64, c1: i64, c2: i64) -> i64
called by 1: ws_eval_word calls 1: wc_lower
62func ws_is_beverb(t: *u8, a: i64, b: i64) -> i64
called by 1: ws_eval_word calls 1: ws_streq_ci
74func ws_is_weak(t: *u8, a: i64, b: i64) -> i64
called by 1: ws_eval_word calls 1: ws_streq_ci
88func ws_eval_word(t: *u8, a: i64, b: i64, out: *i64) -> i64
107func ws_signals(t: *u8, n: i64, out: *i64) -> i64