/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * Secondary-unit regex repair pass — parser-improvement backlog (2026-05-30). * * The three-arena capability eval surfaced a persistent neural weakness: the model DROPS secondary * units. "123 Main St Apt 456" → no unit label; the postal-standards secondary-unit edge class * scored 0% neural. Units have a rigid surface shape (a designator keyword + an identifier), so — * exactly like the postcode-repair pass (#35) — we can detect them deterministically and repair * the BIO labels AFTER decode but BEFORE `buildAddressTree`. The model is untouched; this is a * decoder-side correction, the same "lowest risk" lever family as postcode-repair. * * PRECISION GUARDS (mirror postcode-repair — never regress a confident parse): * * - We only fire on EXPLICIT designators (Apt, Ste, Suite, Unit, Rm, Floor, Bldg, Flat, … + bare * "#"). Ambiguous tokens are deliberately excluded: "Box" (that's po_box), bare "F"/"No" * (too greedy), "Space"/"Stop" (common words). * - ADD path (model emitted no unit over the matched run): allowed ONLY over `O` tokens — never over * house_number / street* / postcode / po_box / a geographic container. So a * confidently-labeled street or number is safe. * - SNAP path: when the model already started a unit span inside the match, we expand/clip it to the * full detected shape. * - Local smear-clip: unit tokens immediately flanking a snapped run are cleared (mirrors * postcode-repair) so "Apt 4 Springfield" can't leave a stray I-unit on "Springfield". * * Opt-in via `ParseOpts.unitRepair` (postcode-repair earned default-on only after a measured * +135/0; unit-repair stays opt-in until the v0.7.2 arena re-run quantifies its delta). */ import type { DecoderToken } from "@mailwoman/core/decoder"; import { type RepairResult } from "./span-repair.ts"; export type { RepairResult } from "./span-repair.ts"; /** * Repair secondary-unit label spans in a decoded token sequence using designator regexes. Returns a NEW token array * (inputs are not mutated) plus a change count. */ export declare function repairUnitLabels(text: string, input: readonly DecoderToken[]): RepairResult; //# sourceMappingURL=unit-repair.d.ts.map