public class DefaultSimilarity extends Similarity
Constructor and Description |
---|
DefaultSimilarity() |
Modifier and Type | Method and Description |
---|---|
float |
coord(int overlap,
int maxOverlap)
Implemented as
overlap / maxOverlap . |
float |
idf(int docFreq,
int numDocs)
Implemented as
log(numDocs/(docFreq+1)) + 1 . |
float |
lengthNorm(String fieldName,
int numTerms)
Implemented as
1/sqrt(numTerms) . |
float |
queryNorm(float sumOfSquaredWeights)
Implemented as
1/sqrt(sumOfSquaredWeights) . |
float |
sloppyFreq(int distance)
Implemented as
1 / (distance + 1) . |
float |
tf(float freq)
Implemented as
sqrt(freq) . |
decodeNorm, encodeNorm, getDefault, idf, idf, setDefault, tf
public float lengthNorm(String fieldName, int numTerms)
1/sqrt(numTerms)
.lengthNorm
in class Similarity
fieldName
- the name of the fieldnumTerms
- the total number of tokens contained in fields named
fieldName of doc.Field.setBoost(float)
public float queryNorm(float sumOfSquaredWeights)
1/sqrt(sumOfSquaredWeights)
.queryNorm
in class Similarity
sumOfSquaredWeights
- the sum of the squares of query term weightspublic float tf(float freq)
sqrt(freq)
.tf
in class Similarity
freq
- the frequency of a term within a documentpublic float sloppyFreq(int distance)
1 / (distance + 1)
.sloppyFreq
in class Similarity
distance
- the edit distance of this sloppy phrase matchPhraseQuery.setSlop(int)
public float idf(int docFreq, int numDocs)
log(numDocs/(docFreq+1)) + 1
.idf
in class Similarity
docFreq
- the number of documents which contain the termnumDocs
- the total number of documents in the collectionpublic float coord(int overlap, int maxOverlap)
overlap / maxOverlap
.coord
in class Similarity
overlap
- the number of query terms matched in the documentmaxOverlap
- the total number of terms in the queryCopyright © 2024 GATE. All rights reserved.