/** * Snippet Generator * Generates context-aware snippets with query term highlighting */ /** * Configuration for snippet generation */ export interface SnippetConfig { /** Target snippet length in characters */ targetLength: number; /** Context before match (characters) */ contextBefore: number; /** Context after match (characters) */ contextAfter: number; /** Whether to highlight query terms */ highlight: boolean; /** Highlight format (markdown bold by default) */ highlightStart: string; highlightEnd: string; /** Ellipsis character for truncation */ ellipsis: string; /** Whether to prefer sentence boundaries */ preferSentenceBoundaries: boolean; } export declare const DEFAULT_SNIPPET_CONFIG: SnippetConfig; /** * Information about a snippet match */ export interface SnippetMatch { start: number; end: number; term: string; } /** * Snippet Generator class */ export declare class SnippetGenerator { private config; constructor(config?: Partial); /** * Generate a snippet from content highlighting query terms */ generate(content: string, query: string): string; /** * Tokenize query into searchable terms */ private tokenizeQuery; /** * Find all matches of query terms in content */ private findMatches; /** * Find the best region using sliding window density */ private findBestRegion; /** * Extract a region from content with proper boundaries */ private extractRegion; /** * Highlight query terms in snippet */ private highlightTerms; /** * Escape special regex characters */ private escapeRegex; /** * Truncate content to target length at word boundary */ private truncateToLength; } /** * Get or create a snippet generator */ export declare function getSnippetGenerator(config?: Partial): SnippetGenerator; /** * Generate a snippet using default configuration */ export declare function generateSnippet(content: string, query: string): string; //# sourceMappingURL=SnippetGenerator.d.ts.map