/** * Dual-pass extraction merge/dedup (opt-in, `distill.extractionPasses: 2` — * see src/config/config.ts and src/distill/prompts/extract.ts's * EXTRACTION_SYSTEM_PROMPT_SPECIFICS_SWEEPER for the full motivation). * * Pass A (the existing extraction prompt) and Pass B (the "specifics * sweeper") run independently over the SAME chunk and are expected to * overlap heavily — Pass B is deliberately told duplicating Pass A is fine, * since asking the model to also guess what Pass A kept costs accuracy on * the one job Pass B actually has. This module reconciles the two atom * lists into one, deterministically and string-only — NO embedding call, by * design (keeps this cheap and free of an extra provider round-trip; a * semantic/embedding-based dedup is explicitly out of v1 scope). * * Rules, applied in order for every atom (Pass A atoms first, then Pass B's * — so a tie always favors Pass A): * 1. Normalize text: lowercase, strip everything but letters and digits * (punctuation AND whitespace both go) — "Once or twice a year." and * "once or twice a year" normalize identically. * 2. Exact-normalized duplicate of an already-kept atom -> drop it. * 3. Otherwise, if its normalized text is a (strict) substring of an * already-kept atom's normalized text, OR an already-kept atom's * normalized text is a substring of ITS normalized text -> duplicate. * The LONGER of the two survives: if the new atom is longer, it replaces * the shorter one already kept; otherwise the new atom is dropped. * 4. Anything left (no exact or substring relation to any kept atom) is * disjoint and is kept as-is. */ import type { Atom } from './prompts/extract.js'; /** Lowercase, strip everything but letters/digits (Unicode-aware) — collapses * case and punctuation/whitespace variants to the same key for comparison. */ export declare function normalizeAtomText(text: string): string; export interface MergeDualPassResult { merged: T[]; /** Count of atoms dropped as exact or substring duplicates (from either * pass) — the per-chunk observability signal the pipeline logs. */ dedupedAway: number; } /** * Merge Pass A's and Pass B's atoms for one chunk. See module doc comment * for the exact-duplicate / substring-duplicate / keep-longer / keep-disjoint * rules. */ export declare function mergeDualPassAtoms(passA: T[], passB: T[]): MergeDualPassResult;