Section navigation

Public classStatic Bm25Scorer

Namespace
Rowles.LeanCorpus.Search.Scoring
Assembly
Rowles.LeanCorpus.dll

BM25 scorer. Computes relevance scores for term matches.

public static class Bm25Scorer
Inheritance
Bm25Scorer

Public method Idf(int, int)

Precomputes the IDF component (constant for a given term across all documents).

Public method NormaliseFieldTermFrequency(float, int, float, float)

Normalises a field term frequency for BM25F-style combined-field scoring before cross-field aggregation.

Public method PrecomputeFactors(int, int, float)

Precomputes factors that are constant for a given field/term. Returns (idf, k1BOverAvgDL) where k1BOverAvgDL = K1 * B / avgDocLength.

Public method Score(int, int, float, int, int)

Computes the BM25 score for a single term in a single document.

Public method ScoreCombinedWithIdf(float, float)

Scores a BM25F-style pseudo term frequency using a precomputed IDF.

Public method ScorePrecomputed(float, float, int, int)

Scores with precomputed IDF and normalisation factor. Avoids per-doc division.

Public method ScorePrecomputedBatch(float, float, ReadOnlySpan<int>, ReadOnlySpan<int>, Span<float>)

Scores multiple documents at once using SIMD for a shared IDF term.