Commit graph

1 commit

Author SHA1 Message Date
Shay
f223e61352 fix(generate): wire intent-aware realizer into chat hot path
The realize_semantic / realize_target pipeline in realizer.py was fully
implemented but never called from chat/runtime.py. The hot path only called
realize() from articulation.py, which returns raw S-P-O word tokens with no
intent, tense, negation, quantifier or rhetorical-move awareness. This
disconnected the 13-construction realizer from every live chat turn.

New module generate/intent_bridge.py:
- classify_intent_from_input() runs the rule-based classifier against the
  raw input text to obtain a DialogueIntent
- articulate_with_intent() builds a PropositionGraph from that intent,
  grounds the <pending> obj slots with recalled vocabulary from the
  generation result, plans articulation via plan_articulation(), and calls
  realize_semantic() for the intent-specific template path
- Falls back cleanly to the existing ArticulationPlan surface when the
  realizer returns an empty plan (OOV-heavy or UNKNOWN intent)

chat/runtime.py change:
- Import and call articulate_with_intent() after the existing realize() call
- Replace articulation.surface with the intent-bridge surface whenever the
  bridge returns a non-empty, non-pending string
- The existing ArticulationPlan dataclass is preserved and passed downstream
  so SentenceAssembler, turn_log, ChatResponse, and all trace fields remain
  structurally unchanged

Effect: chat() now produces intent-differentiated surfaces:
  DEFINITION  → "X is defined as Y"         (was "X Y Z")
  CAUSE       → "X is grounded in Y"         (was "X Y Z")
  CORRECTION  → "correction: X corrects Y"   (was "X Y Z")
  RECALL      → "recalling X: Y"             (was "X Y Z")
  VERIFICATION→ "X is verified: Y"           (was "X Y Z")
  COMPARISON  → "X and Y are distinguished..." (was "X contrasts_with Y")
  PROCEDURE   → "first, Y; then, X follows"  (was "X Y Z")
  CONJUNCTION → "X P and Y P"               (realizer edge handling)
  RELATIVE    → "X, which Pv Y, Pv Z"       (realizer edge handling)

Articulation fidelity is now geometrically honest AND structurally expressive.
The surface corresponds to internal intent state, not a generic S-P-O join.
2026-05-16 08:38:59 -07:00