nx_term_extract.nx
buildroot/runtime/nx_term_extract.nx
about
nx_term_extract.nx -- end-to-end learning orchestrator.
For each beat in a StoryDb:
1. Look up the beat's source bytes from the MediaPool.
2. Run nx_noun_phrase_scan against the beat's span.
3. For each candidate, observe it in nx_term_registry
(registry grows itself; no pre-seeded dictionary).
4. Back-fill beat.outfit_id / location_id / character_id with
the registry slot indices for the strongest matches.
Closes the loop between the ingestion (Tier 0+1) and the
director pipeline: downstream nx_arc / nx_moment_resolve consume
beats with populated element ids, with the actual vocabulary
surfaced from the ingested corpus itself.
Per cardinals:
feedback-self-surfacing-intelligence:
Registry stays in STAGE1 SUPERVISED today. Promotion to
STAGE2 happens automatically after N sightings + 0
contradictions (per nx_term_registry policy). STAGE3
requires user pin or arc-anchor confirmation.
feedback-loras-and-negatives-are-patches:
Confidence is per-term auditable basis points, not an opaque
embedding. Every beat-field assignment is provenance-traceable
back to (beat_id, span_start, span_end, cue_index).
nx_safety_envelope:
intended_use: "Walk a StoryDb's beats, surface noun-phrase
candidates, register them, and back-fill
beat.outfit_id / location_id / character_id."
sil_target: SIL2
asil_target: QM
dal_target: DAL C
iec_62304_class: NONE
evidence: [no_floating_point,
bounded_outer_beat_loop,
bounded_inner_candidate_loop,
registry_overflow_returns_error,
no_topical_dictionary_dependency]
hazard_register: [bug-tape-candidate-spans-cross-paragraph-boundary,
dependencies 6 imports · 6 importers
imports: nx_syscalls.nxnx_storybeat.nxnx_storydb.nxnx_media_pool.nxnx_term_registry.nxnx_noun_phrase_scan.nx
imported by: nx_arc_anchor_test.nxnx_caption_emit_test.nxnx_content_guard_test.nxnx_ingest_cli.nxnx_scene_index_test.nxnx_term_extract_test.nx
structs
| none |
consts
| 58 | const NX_EXTR_OK: i64 = 0 |
| 59 | const NX_EXTR_REGISTRY_FULL: i64 = -1 |
| 60 | const NX_EXTR_BUDGET_EXHAUSTED: i64 = -2 |
| 62 | const NX_EXTR_CAND_CAP: i64 = 32 |
functions
| 70 | func nx_term_extract_beat(db: *StoryDb, registry: *TermRegistry, |
| 152 | func nx_term_extract_all(db: *StoryDb, registry: *TermRegistry) -> i64 |