code wiki / (root) / nx_phrase_match.nx

nx_phrase_match.nx

buildroot/runtime/nx_phrase_match.nx

5264 B154 linesdepth 2pulls 2 transitivereach 9 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_phrase_match.nx -- case-insensitive substring matcher. Tiny utility used by the Tier-2 element extractors (nx_outfit_extract / nx_location_extract / nx_domain_classify) when scanning beat text for known phrases. Why dedicated and not nx_str_find: the canonical nx_string_ops search is case-sensitive (matches C strstr semantics) and pulls in a longer import chain. This file is a small, self-contained case-INSENSITIVE substring detector that handles ASCII upper / lower equivalence inline. Limitations (deliberate): - ASCII only. Multi-byte UTF-8 case folding is NOT done; CJK phrases are matched byte-exact (they have no case anyway). - Word-boundary aware via optional require_boundary flag: if true, match only when neither end is adjacent to an ASCII letter / digit (prevents "apron" matching inside "apronk"). Per the bounded-loop cardinal: outer + inner loops both ride explicit JPL Rule 2 BUDGETS. nx_safety_envelope: intended_use: "Case-insensitive substring search inside a byte range, used by element extractors." sil_target: SIL2 asil_target: QM dal_target: DAL C iec_62304_class: NONE evidence: [no_floating_point, bounded_outer_loop_jpl_rule_2, bounded_inner_loop_jpl_rule_2, ascii_only_case_folding_documented] hazard_register: [bug-tape-utf8-case-fold-not-supported, bug-tape-boundary-check-permissive-on-punct] residual_risk: "ASCII-only fold; CJK phrases match byte-exact. Boundary check treats non- alphanumeric (incl. punctuation) as a boundary -- intended." verdict: NOT_YET_EVALUATED

dependencies 1 imports · 3 importers

nx_syscalls.nx nx_phrase_match.nx nx_content_guard.nx nx_noun_phrase_scan.nx nx_term_extract_test.nx

imports: nx_syscalls.nx

imported by: nx_content_guard.nxnx_noun_phrase_scan.nxnx_term_extract_test.nx

structs

none

consts

none

functions

46func nx_pm_load_u8(p: *u8, i: i64) -> i64
52func nx_pm_to_lower(c: i64) -> i64
60func nx_pm_is_alnum(c: i64) -> i64
84func nx_phrase_find_ci(hay: *u8, nh: i64,
140func nx_phrase_contains_ci(hay: *u8, nh: i64,
147func nx_phrase_strlen(s: *u8, max: i64) -> i64
called by 1: nx_noun_phrase_scan calls 1: nx_pm_load_u8