/** * Tag-based relevance scoring for solution matching. * * Extracted from solution-matcher.ts — the core scoring logic that computes * relevance between a prompt's tags and a solution's tags using a TF-IDF + * BM25 + bigram ensemble. */ /** * Optional hints for the v3 `calculateRelevance` path. Used by hot-path * callers (matchSolutions, searchSolutions) to avoid re-normalizing the * same query tags on every solution. */ export interface CalculateRelevanceOptions { /** * Pre-normalized prompt tags (produced by `defaultNormalizer.normalizeTerms`). * If provided, skips the per-call expansion. Callers loop-running against * many solutions should compute this once outside the loop and pass it in. */ normalizedPromptTags?: string[]; /** * R4-T1: solution tags expanded with compound-split alternatives * (`expandCompoundTags`). When supplied, the intersection/partial-match * step uses this set INSTEAD of `solutionTags`, but the Jaccard union * denominator still uses `solutionTags` (raw) so the score normalization * stays semantically stable. Caller responsibility to pass the matching * pair — `solutionTagsExpanded` MUST be a superset of `solutionTags`. */ solutionTagsExpanded?: string[]; /** Average document (solution) tag count for BM25 normalization. Defaults to 6. */ avgDocLength?: number; /** Meta-learning: dynamic ensemble weights (sum must equal 1.0). Defaults to {tfidf:0.5, bm25:0.3, bigram:0.2}. */ ensembleWeights?: { tfidf: number; bm25: number; bigram: number; }; } export declare function calculateRelevance(promptTags: string[], solutionTags: string[], confidence: number, options?: CalculateRelevanceOptions): { relevance: number; matchedTags: string[]; }; /** @deprecated */ export declare function calculateRelevance(prompt: string, keywords: string[]): number;