@simonecoelhosfo/optimizely-mcp-server
Version:
Optimizely MCP Server for AI assistants with integrated CLI tools
61 lines • 1.59 kB
TypeScript
/**
* FuzzyMatcher - Handles typos and variations in natural language queries
*
* IMPLEMENTATION STATUS:
* COMPLETE: Levenshtein distance, soundex, n-gram matching
*
* Last Updated: July 3, 2025
*/
import { EntityType } from '../types/index.js';
export interface FuzzyMatch {
original: string;
matched: string;
confidence: number;
type: 'entity' | 'field' | 'action';
algorithm: 'exact' | 'levenshtein' | 'soundex' | 'ngram';
}
export declare class FuzzyMatcher {
private readonly maxDistance;
private readonly minSimilarity;
constructor(config?: {
maxDistance?: number;
minSimilarity?: number;
});
/**
* Find best entity match using fuzzy matching
*/
findEntity(term: string): FuzzyMatch | null;
/**
* Find best field match using fuzzy matching
*/
findField(term: string, entityContext?: EntityType): FuzzyMatch | null;
/**
* Levenshtein distance algorithm
*/
private levenshteinDistance;
/**
* Soundex algorithm for phonetic matching
*/
private soundex;
/**
* N-gram similarity calculation
*/
private ngramSimilarity;
/**
* Generate n-grams from string
*/
private getNgrams;
/**
* Get singular form of a word (simple rules)
*/
private getSingular;
/**
* Get plural form of a word (simple rules)
*/
private getPlural;
/**
* Find best matches for a phrase
*/
findBestMatches(phrase: string, maxResults?: number): FuzzyMatch[];
}
//# sourceMappingURL=FuzzyMatcher.d.ts.map