/** * Stemming and fuzzy matching for keyword scoring */ /** Discount factor applied to fuzzy match scores */ export declare const FUZZY_DISCOUNT = 0.8; /** * Match quality in priority order: exact > stem > fuzzy */ export type MatchQuality = 'exact' | 'stem' | 'fuzzy'; export interface KeywordMatchResult { matched: boolean; quality: MatchQuality; matchedWord: string; } /** * Lightweight suffix-stripping stemmer. * Words shorter than 4 characters are returned unchanged. */ export declare function stem(word: string): string; /** * Levenshtein distance with early termination. * Uses O(min(m,n)) space via single-row DP. * * @returns Edit distance, or maxDistance+1 if distance exceeds maxDistance */ export declare function levenshteinDistance(a: string, b: string, maxDistance: number): number; /** * Returns the maximum allowed edit distance for a keyword of a given length. * Short words (1-3 chars) get no fuzzy matching to avoid false positives. */ export declare function fuzzyThreshold(wordLength: number): number; /** * Pre-computes a map from stemmed form → original word for all prompt words. * Used once per scoring call to avoid redundant stem() calls. */ export declare function buildStemmedWordMap(words: Set): Map; /** * Matches a single keyword against prompt words using the priority chain: * exact → stem → fuzzy. * * @param keywordLower - The keyword in lowercase * @param words - Set of normalized prompt words * @param stemmedWords - Pre-computed stem → original word map * @returns Match result with quality level and the matched word */ export declare function matchKeyword(keywordLower: string, words: Set, stemmedWords: Map): KeywordMatchResult; //# sourceMappingURL=matching.d.ts.map