core/generate
Shay 7ee0983178 feat(parser): ADR-0123a — comparison shape-gap expansion (Gemini Task 5 scope cut)
Closes 5 of 8 surface-form gaps Gemini identified in Task 5 on the
99 comparison-bearing sentences my ADR-0123 substrate currently refuses
in the sealed holdout. Pure regex / parser-state work — no graph,
solver, verifier, or pack changes; preserves wrong==0 discipline.

Expansions (in safety order)
- Group 8 (verb): comparison verbs widened from {has} to {has, have,
  had, gets, get, got, takes, take, took, buys, buy, bought}.
  "lost"/"won" excluded — they semantically invert direction.
- Group 3 (word-form numbers): _WORD_NUMBERS {one..twelve} accepted
  wherever digit values are. _parse_compare_number helper centralizes
  the dispatch.
- Group 4 (ellipsis / implicit unit): unit slot made optional in
  multiplicative patterns (solver already infers unit from reference
  state); added "twice|N times as much", "twice|N times the
  number/amount of <unit>" variants.
- Group 1 (subjects / references): actor/reference slots widened from
  bare proper noun to {proper noun, "the <noun>" collective,
  pronoun}. Pronouns resolve via state.last_singular_subject; missing
  prior subject raises ParseError (no silent emission with empty
  actor). New _resolve_compare_entity helper canonicalizes "The boys"
  / "the boys" to the same entity string.
- Initial-possession + question patterns widened symmetrically so
  "the X" subjects round-trip end-to-end:
  - _INITIAL_HAS_RE accepts "the <noun>" subject + has/have +
    digit-or-word value
  - _Q_ENTITY_RE accepts "the <noun>" entity + do/does auxiliary
  - _Q_TOTAL_RE now tried first (specificity-ordered) so "do they
    have" doesn't get greedily matched as entity="they"

Deferred (per Gemini Task 5c recommendation)
- Group 2 (age): needs new "years_old" attribute model
- Group 5 (nested): needs compound y = mx + c solver operation
- Group 7 (currency): low volume (2 cases), defer
- Group 6 (compound multi-clause "and" split): scoped out of this
  PR to keep the wrong==0 risk profile tight; safer to land after
  Gemini Task 6 confirms current expansion doesn't introduce
  misparses on the sealed set

Test coverage
- 507 existing math + ADR-0122 + ADR-0123 tests pass (no regressions)
- 16 ad-hoc smoke cases pass (3 baseline + 3 Group 8 + 3 Group 3 +
  3 Group 4 + 3 Group 1 + 2 refusal guards + 1 rate cross-check)
- smoke suite 67/67, algebra suite 82/82 green

Expected sealed lift
- Gemini Task 5 catalog projected ~65/90 strict-comparison-only
  cases unblocked by the 5 included groups (71/99 comparison-bearing
  sentences). Empirical sealed measurement pending Gemini Task 6;
  PR will be updated with the actual correct/wrong/refused bucket
  counts once measured.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 02:24:38 -07:00
..
__init__.py chore(generate): delete unreachable agenerate (#90) 2026-05-20 19:59:28 -07:00
admissibility.py feat(adr-0026): Phase 3 — ranked admissibility with margin 2026-05-17 15:03:03 -07:00
articulation.py
articulation_legality.py feat(realizer): C1.5 — articulation legality at the realizer boundary 2026-05-20 11:11:28 -07:00
attention.py
bridge_trace.py Phase 1 — bridge trace instrumentation (observation-only) 2026-05-18 18:04:57 -07:00
dialogue.py
discourse_planner.py feat(discourse): Phase 2 — reflective rendering pronominalizes focus subject 2026-05-21 10:16:12 -07:00
exhaustion.py feat(adr-0025): Phase 4 — rotor / frame admissibility at the seam 2026-05-17 15:16:32 -07:00
graph_constraint.py fix(adr-0046): make forward-graph-constraint branch mergeable 2026-05-18 05:57:46 -07:00
graph_planner.py perf(graph): PropositionGraph.topo_order — Kahn's O(N+E) instead of O(N×E) (#92) 2026-05-20 20:37:21 -07:00
grounding_accessors.py feat(grounding): structured GroundedFact accessors for discourse planner 2026-05-19 11:19:59 -07:00
intent.py fix(intent): route 'Actually X R Y' premises to CORRECTION (inference_closure) (#117) 2026-05-22 12:33:56 -07:00
intent_bridge.py Phase 2 — proposition-slot grounding for articulate_with_intent 2026-05-18 18:18:31 -07:00
intent_ratifier.py chore(ratifier): calibrate default ratification threshold 0.0 → 0.5 (#86) 2026-05-20 19:59:25 -07:00
math_parser.py feat(parser): ADR-0123a — comparison shape-gap expansion (Gemini Task 5 scope cut) 2026-05-23 02:24:38 -07:00
math_problem_graph.py feat(parser): ADR-0123 comparison-phrasing substrate (substrate-only; lift deferred) 2026-05-23 01:56:28 -07:00
math_realizer.py feat(realizer): ADR-0123 comparison-phrasing surface (closes substrate) 2026-05-23 02:03:49 -07:00
math_solver.py feat(parser): ADR-0123 comparison-phrasing substrate (substrate-only; lift deferred) 2026-05-23 01:56:28 -07:00
math_verifier.py feat(parser): ADR-0123 comparison-phrasing substrate (substrate-only; lift deferred) 2026-05-23 01:56:28 -07:00
morphology.py fix(gaps): close G1+G2+G3 + identity vocab + pipeline safety-stub honour 2026-05-16 21:21:06 -07:00
ood_surface_generator.py feat: ADR-0118a OOD surface generator 2026-05-22 16:49:40 -07:00
operators.py feat(compositionality): compose_relations operator lifts lane 68.8% → 100% 2026-05-16 22:44:06 -07:00
perturbation_suite.py feat: add ADR-0125 perturbation suite 2026-05-22 17:12:33 -07:00
proposition.py feat(adr-0022): Forward Semantic Control — Accepted 2026-05-17 12:10:20 -07:00
realizer.py perf(cognition): hot-path comb pass — 5 mechanical-sympathy fixes (#91) 2026-05-20 20:31:56 -07:00
realizer_guard.py feat(coherence): ADR-0075 — realizer slot-type guard (C1) 2026-05-19 22:35:09 -07:00
render.py
result.py feat(adr-0023): Forward Semantic Control proof evidence — Accepted 2026-05-17 12:55:19 -07:00
rotor_admissibility.py feat(adr-0025): Phase 4 — rotor / frame admissibility at the seam 2026-05-17 15:16:32 -07:00
salience.py
semantic_templates.py feat: vault recall index, Rust versor parity, cognitive pack expansion 2026-05-15 15:34:39 -07:00
stream.py chore(generate): make stop-tokens caller-overridable via RuntimeConfig (#87) 2026-05-20 19:59:33 -07:00
surface.py feat(surface): ADR-0031 — score-decomposition surface (per-axis hedges) 2026-05-17 20:16:22 -07:00
templates.py feat(realizer): C1.5 — articulation legality at the realizer boundary 2026-05-20 11:11:28 -07:00