Section navigation

Public classSealed LMJelinekMercerSimilarity

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

Language-model similarity with Jelinek-Mercer (linear interpolation) smoothing. Interpolates the document model with the collection model using a coefficient 位.

Score = log((1-位) 路 (tf/|d|) + 位 路 P(t|C)), where P(t|C) = collectionFrequency / totalTermsInCollection.

Default 位 = 0.1.

public sealed class LMJelinekMercerSimilarity : ISimilarity
Inheritance
LMJelinekMercerSimilarity
Implements

Public constructor LMJelinekMercerSimilarity(float)

Initialises a new instance with the specified interpolation coefficient 位.

Public field Instance

Gets a shared singleton instance with the default 位 = 0.1.

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 PrecomputeLmFactors(int, int, float, long, long)

Precomputes factors including collection-level term statistics for language-model similarities. Default simply delegates to PrecomputeFactors(int, int, float) and sets CollectionProb to 0.

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

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

Public method ScoreLmPrecomputed(float, float, float, int, int)

Scores using precomputed language-model factors. Default delegates to ScorePrecomputed(float, float, int, int), ignoring collectionProb.

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

Scores using precomputed factors for hot-path scoring.