Interface BM25Config

Configuration options for the BM25 index.

Interface

BM25Config

interface BM25Config {
    k1?: number;
    b?: number;
    pipeline?: TextProcessingPipeline;
    tokenize?: ((text) => string[]);
}

Properties

k1?: number

Term saturation parameter. Higher values increase the influence of term frequency. Range: 1.2-2.0 typical.

b?: number

Document length normalization factor. 0 = no normalization, 1 = full normalization. Range: 0-1.

pipeline?: TextProcessingPipeline

Optional text processing pipeline for tokenization. When provided, replaces the built-in regex tokenizer with configurable stemming, lemmatization, and stop word handling.

See

createRagPipeline from nlp for the recommended default.

tokenize?: ((text) => string[])

A tokenizer used in place of pipeline and the built-in one.

Type declaration

    • (text): string[]
    • Parameters

      • text: string

      Returns string[]