Package org.terrier.matching.models
Class PerFieldNormWeightingModel
- java.lang.Object
-
- org.terrier.matching.models.WeightingModel
-
- org.terrier.matching.models.PerFieldNormWeightingModel
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,Model
public class PerFieldNormWeightingModel extends WeightingModel
A class for generating arbitrary per-field normalisation models. Per-field normalisation models are field-based models - i.e. they take into account the frequency of a term in each individual field of the document. In particular, they apply length normalisation on the frequency from each field, before using a linear combination of term frequencies to garner the final frequency.Properties:
- w.fieldId (starting at 0)
- c.fieldId (starting at 0)
- Since:
- 3.0
- Author:
- Craig Macdonald
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BasicModel
basicModel
protected int
fieldCount
protected double[]
fieldGlobalFrequencies
protected Normalisation[]
fieldNormalisations
protected double[]
fieldWeights
protected java.lang.String[]
params
-
Fields inherited from class org.terrier.matching.models.WeightingModel
averageDocumentLength, c, cs, documentFrequency, es, i, keyFrequency, numberOfDocuments, numberOfPointers, numberOfPostings, numberOfTokens, numberOfUniqueTerms, rq, termFrequency
-
-
Constructor Summary
Constructors Constructor Description PerFieldNormWeightingModel(java.lang.Class<? extends BasicModel> _basicModel, java.lang.Class<? extends Normalisation> _normalisationModel)
Constructs an instance of PerFieldNormWeightingModelPerFieldNormWeightingModel(java.lang.String[] parameters)
Constructs an instance of PerFieldNormWeightingModel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PerFieldNormWeightingModel
clone()
Clone this weighting modeljava.lang.String
getInfo()
Returns the name of the model.void
prepare()
preparedouble
score(double tf, double docLength)
This method provides the contract for implementing weighting models.double
score(Posting _p)
Returns scorevoid
setCollectionStatistics(CollectionStatistics _cs)
Sets collection statisticsvoid
setEntryStatistics(EntryStatistics _es)
Sets entry statistics.-
Methods inherited from class org.terrier.matching.models.WeightingModel
getOverflowed, getParameter, setKeyFrequency, setParameter, setRequest
-
-
-
-
Field Detail
-
params
protected java.lang.String[] params
-
basicModel
protected BasicModel basicModel
-
fieldNormalisations
protected Normalisation[] fieldNormalisations
-
fieldGlobalFrequencies
protected double[] fieldGlobalFrequencies
-
fieldWeights
protected double[] fieldWeights
-
fieldCount
protected int fieldCount
-
-
Constructor Detail
-
PerFieldNormWeightingModel
public PerFieldNormWeightingModel(java.lang.Class<? extends BasicModel> _basicModel, java.lang.Class<? extends Normalisation> _normalisationModel) throws java.lang.Exception
Constructs an instance of PerFieldNormWeightingModel- Parameters:
_basicModel
-_normalisationModel
-- Throws:
java.lang.Exception
-
PerFieldNormWeightingModel
public PerFieldNormWeightingModel(java.lang.String[] parameters) throws java.lang.Exception
Constructs an instance of PerFieldNormWeightingModel- Parameters:
parameters
-- Throws:
java.lang.Exception
-
-
Method Detail
-
clone
public PerFieldNormWeightingModel clone()
Description copied from class:WeightingModel
Clone this weighting model- Overrides:
clone
in classWeightingModel
-
prepare
public void prepare()
Description copied from class:WeightingModel
prepare- Overrides:
prepare
in classWeightingModel
-
score
public double score(Posting _p)
Description copied from class:WeightingModel
Returns score- Overrides:
score
in classWeightingModel
- Returns:
- score
-
setCollectionStatistics
public void setCollectionStatistics(CollectionStatistics _cs)
Description copied from class:WeightingModel
Sets collection statistics- Overrides:
setCollectionStatistics
in classWeightingModel
-
setEntryStatistics
public void setEntryStatistics(EntryStatistics _es)
Sets entry statistics.- Overrides:
setEntryStatistics
in classWeightingModel
-
getInfo
public java.lang.String getInfo()
Returns the name of the model.- Specified by:
getInfo
in interfaceModel
- Specified by:
getInfo
in classWeightingModel
- Returns:
- java.lang.String
-
score
public double score(double tf, double docLength)
Description copied from class:WeightingModel
This method provides the contract for implementing weighting models.- Specified by:
score
in classWeightingModel
- Parameters:
tf
- The term frequency in the documentdocLength
- the document's length- Returns:
- the score assigned to a document with the given tf and docLength, and other preset parameters
-
-