Section navigation

Public classSealed TfIdfPivotedSimilarity

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

Pivoted document length normalisation TF-IDF scoring model (Singhal et al.). Uses a linear interpolation between constant and dl/avgdl instead of 1/sqrt(dl), which penalises long documents less aggressively.

tf = sqrt(tf).

len_norm = 1 / ((1-s) + s * dl/avgdl).

Score = tf * idf * len_norm.

Default: s=0.2.

public sealed class TfIdfPivotedSimilarity : ISimilarity
Inheritance
TfIdfPivotedSimilarity
Implements

Public constructor TfIdfPivotedSimilarity(float)

Initialises a new instance with the specified pivoted normalisation slope.

Public field Instance

Gets the shared singleton instance with the default slope (s=0.2).

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.