|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.terrier.matching.models.WeightingModel org.terrier.matching.tsms.TermInFieldModifier
public class TermInFieldModifier
Resets the scores of documents according to whether a term appears in a given set of fields. This class implements the TermScoreModifier interface.
Field Summary | |
---|---|
protected java.lang.String |
field
The fields that a query term should appear in. |
protected Index |
index
|
protected boolean |
requirement
The requirement. |
Fields inherited from class org.terrier.matching.models.WeightingModel |
---|
averageDocumentLength, c, documentFrequency, i, keyFrequency, numberOfDocuments, numberOfPointers, numberOfTokens, numberOfUniqueTerms, termFrequency |
Constructor Summary | |
---|---|
TermInFieldModifier(java.lang.String _field)
Constructs an instance of a TermInFieldModifier given a field that the corresponding query term should appear in. |
|
TermInFieldModifier(java.lang.String _field,
boolean req)
Constructs an instance of a TermInFieldModifier given a field that the corresponding query term should appear in. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Clone this weighting model |
java.lang.String |
getInfo()
Returns the name of the model. |
java.lang.String |
getName()
Returns the name of the modifier. |
int |
modifyScores(double[] scores,
int[][] pointers)
Resets the scores of documents for a particular term, based on the fields a term appears in documents. |
void |
prepare()
prepare |
double |
score(double tf,
double docLength)
This method provides the contract for implementing weighting models. |
double |
score(double tf,
double docLength,
double n_t,
double F_t,
double keyFrequency)
This method provides the contract for implementing weighting models. |
double |
score(Posting _p)
Returns score |
void |
setIndex(Index i)
Tell the implementer which Index object it is associated with. |
Methods inherited from class org.terrier.matching.models.WeightingModel |
---|
getOverflowed, getParameter, setAverageDocumentLength, setCollectionStatistics, setDocumentFrequency, setEntryStatistics, setKeyFrequency, setNumberOfDocuments, setNumberOfPointers, setNumberOfTokens, setNumberOfUniqueTerms, setParameter, setRequest, setTermFrequency, stirlingPower |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.terrier.matching.tsms.TermScoreModifier |
---|
hashCode |
Field Detail |
---|
protected transient Index index
protected java.lang.String field
protected boolean requirement
Constructor Detail |
---|
public TermInFieldModifier(java.lang.String _field)
_field
- String a fieldpublic TermInFieldModifier(java.lang.String _field, boolean req)
_field
- String a fieldreq
- boolean the requirement for this field. If req is
true, then the term is required to appear in the field
(this is the default behaviour), otherwise the term
should not appear in the field.Method Detail |
---|
public int modifyScores(double[] scores, int[][] pointers)
modifyScores
in interface TermScoreModifier
scores
- double[] the scores of the documents.pointers
- int[][] the pointers read from the inverted file
for a particular query term.
public void prepare()
prepare
in class WeightingModel
public double score(Posting _p)
score
in class WeightingModel
public java.lang.String getName()
getName
in interface TermScoreModifier
public java.lang.Object clone()
clone
in interface TermScoreModifier
clone
in class WeightingModel
public java.lang.String getInfo()
WeightingModel
getInfo
in interface Model
getInfo
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 length
public double score(double tf, double docLength, double n_t, double F_t, double keyFrequency)
WeightingModel
score
in class WeightingModel
tf
- The term frequency in the documentdocLength
- the document's lengthn_t
- The document frequency of the termF_t
- the term frequency in the collectionkeyFrequency
- the term frequency in the query
public void setIndex(Index i)
setIndex
in interface IndexConfigurable
i
- Index object to use
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |