public class RequiredTermModifier extends WeightingModel implements Serializable
averageDocumentLength, c, cs, documentFrequency, es, i, keyFrequency, numberOfDocuments, numberOfPointers, numberOfTokens, numberOfUniqueTerms, rq, termFrequency
Constructor and Description |
---|
RequiredTermModifier(boolean r)
Constructs an instance of a TermInFieldModifier given the
requirement that the term should, or should not appear
in the query.
|
Modifier and Type | Method and Description |
---|---|
String |
getInfo()
Returns the name of the model.
|
String |
getName()
Returns the name of the class and whether the query term is required.
|
int |
hashCode() |
int |
modifyScores(double[] scores,
int[][] pointers)
Resets the scores of documents for a particular term, based on
the requirement of appearance of the corresponding term.
|
double |
score(double tf,
double docLength)
This method provides the contract for implementing weighting models.
|
double |
score(Posting p)
Returns score
|
clone, getOverflowed, getParameter, prepare, setCollectionStatistics, setEntryStatistics, setKeyFrequency, setParameter, setRequest
public RequiredTermModifier(boolean r)
r
- boolean indicates whether the term is required
to appear in the retrieved documents.public int modifyScores(double[] scores, int[][] pointers)
scores
- double[] the scores of the documents.pointers
- int[][] the pointers read from the inverted file
for a particular query term.public String getName()
public String getInfo()
WeightingModel
getInfo
in interface Model
getInfo
in class WeightingModel
public double score(Posting p)
score
in class WeightingModel
public double score(double tf, double docLength)
WeightingModel
score
in class WeightingModel
tf
- The term frequency in the documentdocLength
- the document's lengthTerrier Information Retrieval Platform4.1. Copyright © 2004-2015, University of Glasgow