Class LMSimilarity
- java.lang.Object
-
- org.apache.lucene.search.similarities.Similarity
-
- org.apache.lucene.search.similarities.SimilarityBase
-
- org.apache.lucene.search.similarities.LMSimilarity
-
- Direct Known Subclasses:
LMDirichletSimilarity
,LMJelinekMercerSimilarity
public abstract class LMSimilarity extends SimilarityBase
Abstract superclass for language modeling Similarities. The following inner types are introduced:LMSimilarity.LMStats
, which defines a new statistic, the probability that the collection language model generates the current term;LMSimilarity.CollectionModel
, which is a strategy interface for object that compute the collection language modelp(w|C)
;LMSimilarity.DefaultCollectionModel
, an implementation of the former, that computes the term probability as the number of occurrences of the term in the collection, divided by the total number of tokens.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
LMSimilarity.CollectionModel
A strategy for computing the collection language model.static class
LMSimilarity.DefaultCollectionModel
Modelsp(w|C)
as the number of occurrences of the term in the collection, divided by the total number of tokens+ 1
.static class
LMSimilarity.LMStats
Stores the collection distribution of the current term.-
Nested classes/interfaces inherited from class org.apache.lucene.search.similarities.Similarity
Similarity.SimScorer, Similarity.SimWeight
-
-
Constructor Summary
Constructors Constructor Description LMSimilarity()
Creates a new instance with the default collection language model.LMSimilarity(LMSimilarity.CollectionModel collectionModel)
Creates a new instance with the specified collection language model.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.String
getName()
Returns the name of the LM method.java.lang.String
toString()
Returns the name of the LM method.-
Methods inherited from class org.apache.lucene.search.similarities.SimilarityBase
computeNorm, computeWeight, getDiscountOverlaps, log2, setDiscountOverlaps, simScorer
-
Methods inherited from class org.apache.lucene.search.similarities.Similarity
coord, queryNorm
-
-
-
-
Constructor Detail
-
LMSimilarity
public LMSimilarity(LMSimilarity.CollectionModel collectionModel)
Creates a new instance with the specified collection language model.
-
LMSimilarity
public LMSimilarity()
Creates a new instance with the default collection language model.
-
-
Method Detail
-
getName
public abstract java.lang.String getName()
Returns the name of the LM method. The values of the parameters should be included as well.Used in
.toString()
-
toString
public java.lang.String toString()
Returns the name of the LM method. If a custom collection model strategy is used, its name is included as well.- Specified by:
toString
in classSimilarityBase
- See Also:
getName()
,LMSimilarity.CollectionModel.getName()
,LMSimilarity.DefaultCollectionModel
-
-