/** * Diversity Penalty (MMR-inspired). * * Penalizes results that are too similar to results already selected, so the * top-N covers more distinct topics instead of restating the same chunk in * different words. Operates on string similarity (Jaccard over normalized * tokens) rather than embeddings, so it has zero extra cost and no embedding * dependency at this layer. */ import type { SearchResult } from "@massa-th0th/shared"; export interface DiversityPenaltyConfig { enabled: boolean; threshold: number; lambda: number; /** Additional penalty applied when two results share the same filePath (IMP-4). */ samePathPenalty?: number; } /** * Apply MMR-style diversity penalty in score order. * Returns a new array, sorted by adjusted score DESC. Original list is not mutated. * * IMP-4: in addition to token Jaccard, a same-`filePath` penalty is applied * so chunks from the same file get demoted relative to chunks from new files. * Token similarity between two chunks of the same file is usually low (they * cover different lines), so this is a complementary signal, not a duplicate. */ export declare function applyDiversityPenalty(results: SearchResult[], config: DiversityPenaltyConfig): SearchResult[]; //# sourceMappingURL=diversity-penalty.d.ts.map