public class LMJelinekMercerSimilarity extends LMSimilarity
The model has a single parameter, λ. According to said paper, the
optimal value depends on both the collection and the query. The optimal value
is around 0.1 for title queries and 0.7 for long queries.
LMSimilarity.CollectionModel, LMSimilarity.DefaultCollectionModel, LMSimilarity.LMStatsSimilarity.SimScorer, Similarity.SimWeightcollectionModeldiscountOverlaps| Constructor and Description |
|---|
LMJelinekMercerSimilarity(float lambda)
Instantiates with the specified λ parameter.
|
LMJelinekMercerSimilarity(LMSimilarity.CollectionModel collectionModel,
float lambda)
Instantiates with the specified collectionModel and λ parameter.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
explain(Explanation expl,
BasicStats stats,
int doc,
float freq,
float docLen)
Subclasses should implement this method to explain the score.
|
float |
getLambda()
Returns the λ parameter.
|
String |
getName()
Returns the name of the LM method.
|
protected float |
score(BasicStats stats,
float freq,
float docLen)
Scores the document
doc. |
fillBasicStats, newStats, toStringcomputeNorm, computeWeight, decodeNormValue, encodeNormValue, explain, getDiscountOverlaps, log2, setDiscountOverlaps, simScorercoord, queryNormpublic LMJelinekMercerSimilarity(LMSimilarity.CollectionModel collectionModel, float lambda)
public LMJelinekMercerSimilarity(float lambda)
protected float score(BasicStats stats, float freq, float docLen)
SimilarityBasedoc.
Subclasses must apply their scoring formula in this class.
score in class SimilarityBasestats - the corpus level statistics.freq - the term frequency.docLen - the document length.protected void explain(Explanation expl, BasicStats stats, int doc, float freq, float docLen)
SimilarityBaseexpl
already contains the score, the name of the class and the doc id, as well
as the term frequency and its explanation; subclasses can add additional
clauses to explain details of their scoring formulae.
The default implementation does nothing.
explain in class LMSimilarityexpl - the explanation to extend with details.stats - the corpus level statistics.doc - the document id.freq - the term frequency.docLen - the document length.public float getLambda()
public String getName()
LMSimilarityUsed in LMSimilarity.toString()
getName in class LMSimilarityCopyright © 2000-2013 Apache Software Foundation. All Rights Reserved.