Section navigation

Public classSealed TfIdfAugmentedSimilarity

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

Augmented TF-IDF scoring model. Uses a pivoted term frequency that reduces the impact of high-TF terms within a document. The parameter K controls the pivot point.

tf_aug = K + (1-K) * tf / (tf + K).

len_norm = 1 / sqrt(dl).

Score = tf_aug * idf * len_norm.

Default: K=0.5.

public sealed class TfIdfAugmentedSimilarity : ISimilarity
Inheritance
TfIdfAugmentedSimilarity
Implements

Public constructor TfIdfAugmentedSimilarity(float)

Initialises a new instance with the specified pivot parameter K.

Public field Instance

Gets the shared singleton instance with the default pivot (K=0.5).

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.