Project Files
dist / strategies / relevance.d.ts
/**
* @file relevance.ts
* @description Relevance-based sampling strategy.
* Scores chunks by BM25-style term frequency against a user-provided query.
* Returns chunks sorted by relevance score descending.
*/
import type { Chunk, SamplingConfig } from "../types";
/**
* Score chunks by BM25-style relevance against a query.
*
* Algorithm:
* 1. Tokenise the query into search terms.
* 2. Split text into fixed-size chunks using the length-based strategy.
* 3. Compute BM25 score for each chunk against the query terms.
* 4. Return chunks sorted by relevance score descending.
*
* @param text - The input text to sample.
* @param config - Sampling configuration (must include query for relevance).
* @returns Chunks sorted by relevance score descending.
* @throws If config.query is missing or empty.
*/
export declare function sampleByRelevance(text: string, config: SamplingConfig): readonly Chunk[];
//# sourceMappingURL=relevance.d.ts.map