The curated, irreducible world-fact primitives multi-step composition needs (ADR-0175 section 10: the engine can't derive 'twice = 2' from arithmetic). The microscope flagged these via the 0015/0025/0024/0033 wrongs. language_packs/data/en_core_comparatives_v1/: 9 closed-set multiplicative comparatives (twice/double/triple/quadruple/half/quarter + inflections) -> scalar ops. manifest.json with sha256 of the bytes on disk (CLAUDE.md pack rule). Refusal-preferring: non-terminating/ambiguous comparatives (a third, several) deliberately excluded; expansion via HITL corridor. generate/derivation/comparatives.py: extract_comparative_scalars() -> ComparativeScalar(op, scalar, span, cue). Fixed lexemes + the '<number> times' pattern (digit or word-number via WORD_NUMBERS). Lexeme-level (ADR-0165); deterministic (text-order); supplies only the SCALAR primitive — referent binding is the multi-step search's job (ADR-0176). 14 tests incl. refusal-preferring discipline + pack integrity (manifest checksum matches bytes on disk). Verified: derivation suite 45/45; ruff clean; smoke 67; packs 141. Not wired into serving (data + extractor ready for ADR-0176 MS phases).
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
"""ADR-0175 Phase 3 — grounded derivation search + self-verification gate.
|
|
|
|
Phase 3a (this surface): the self-verification gate — grounded operands ∧
|
|
grounded operation cues ∧ unit consistency ∧ uniqueness. The wrong=0-critical
|
|
guard that keeps the (Phase 3b) bounded search honest.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from generate.derivation.comparatives import (
|
|
ComparativeScalar,
|
|
extract_comparative_scalars,
|
|
)
|
|
from generate.derivation.extract import extract_quantities
|
|
from generate.derivation.model import GroundedDerivation, Quantity, Step, VALID_OPS
|
|
from generate.derivation.search import MULTIPLICATIVE_CUES, search_multiplicative
|
|
from generate.derivation.verify import (
|
|
Resolution,
|
|
SelfVerification,
|
|
select_self_verified,
|
|
self_verifies,
|
|
)
|
|
|
|
__all__ = [
|
|
"ComparativeScalar",
|
|
"GroundedDerivation",
|
|
"MULTIPLICATIVE_CUES",
|
|
"Quantity",
|
|
"Resolution",
|
|
"SelfVerification",
|
|
"Step",
|
|
"VALID_OPS",
|
|
"extract_comparative_scalars",
|
|
"extract_quantities",
|
|
"search_multiplicative",
|
|
"select_self_verified",
|
|
"self_verifies",
|
|
]
|