/** * MRSF Fuzzy Matching Engine * * Provides exact, normalized, token-level LCS, and character-level * Levenshtein matching for re-anchoring selected_text. */ import type { FuzzyCandidate } from "./types.js"; export declare const MAX_FUZZY_CANDIDATE_LINES = 64; export interface FuzzySearchIndex { lines: string[]; tokenPostings: Map; trigramPostings: Map; } export declare function createFuzzySearchIndex(lines: string[]): FuzzySearchIndex; /** * Find all exact occurrences of `needle` in lines (1-based array). */ export declare function exactMatch(lines: string[], needle: string): FuzzyCandidate[]; /** * Find matches after normalizing whitespace. */ export declare function normalizedMatch(lines: string[], needle: string): FuzzyCandidate[]; /** * Score two texts using token-level LCS. * Returns 0.0–1.0. */ export declare function tokenLcsScore(a: string, b: string): number; /** * Normalized Levenshtein similarity 0.0–1.0. */ export declare function levenshteinScore(a: string, b: string): number; /** * Compute a combined similarity score between two text fragments. * Blends token LCS (structural) and Levenshtein (character-level). */ export declare function combinedScore(needle: string, candidate: string): number; /** * Search the document for fuzzy matches of `needle`. * * @param lines 1-based line array (index 0 unused). * @param needle The original selected_text. * @param threshold Minimum score to include (0.0–1.0). * @param hintLine Optional original line number for proximity scoring. */ export declare function fuzzySearch(lines: string[], needle: string, threshold?: number, hintLine?: number, index?: FuzzySearchIndex): FuzzyCandidate[]; /** * Compute fuzzy candidates once and partition them by their unadjusted * similarity thresholds. Proximity remains a ranking bonus and does not make * a candidate eligible for a threshold it did not originally satisfy. */ export declare function fuzzySearchThresholds(lines: string[], needle: string, thresholds: number[], hintLine?: number, index?: FuzzySearchIndex): Map; //# sourceMappingURL=fuzzy.d.ts.map