Section navigation

Public classSealed Bm25PlusSimilarity

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

BM25+ scoring model. Extends BM25 with a lower-bound delta constant to fix BM25's tendency to produce near-zero scores for very short documents.

Score = idf * (normalised_tf + delta).

Default: k1=1.2, b=0.75, delta=1.0.

public sealed class Bm25PlusSimilarity : ISimilarity
Inheritance
Bm25PlusSimilarity
Implements

Public constructor Bm25PlusSimilarity(float, float, float)

Initialises a new instance with the specified BM25+ parameters.

Public field Instance

Gets the shared singleton instance with default parameters (k1=1.2, b=0.75, delta=1.0).

Public property RequiresCollectionStatistics

Whether this similarity requires collection-level statistics (total term frequency and total terms in collection) for scoring.

Public method PrecomputeFactors(int, int, float)

Precomputes factors constant for a given term across all documents.

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

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

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

Scores using precomputed factors for hot-path scoring.