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 BasicModelbasicModelprotected intfieldCountprotected double[]fieldGlobalFrequenciesprotected Normalisation[]fieldNormalisationsprotected double[]fieldWeightsprotected 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 PerFieldNormWeightingModelclone()Clone this weighting modeljava.lang.StringgetInfo()Returns the name of the model.voidprepare()preparedoublescore(double tf, double docLength)This method provides the contract for implementing weighting models.doublescore(Posting _p)Returns scorevoidsetCollectionStatistics(CollectionStatistics _cs)Sets collection statisticsvoidsetEntryStatistics(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.ExceptionConstructs an instance of PerFieldNormWeightingModel- Parameters:
parameters-- Throws:
java.lang.Exception
-
-
Method Detail
-
clone
public PerFieldNormWeightingModel clone()
Description copied from class:WeightingModelClone this weighting model- Overrides:
clonein classWeightingModel
-
prepare
public void prepare()
Description copied from class:WeightingModelprepare- Overrides:
preparein classWeightingModel
-
score
public double score(Posting _p)
Description copied from class:WeightingModelReturns score- Overrides:
scorein classWeightingModel- Returns:
- score
-
setCollectionStatistics
public void setCollectionStatistics(CollectionStatistics _cs)
Description copied from class:WeightingModelSets collection statistics- Overrides:
setCollectionStatisticsin classWeightingModel
-
setEntryStatistics
public void setEntryStatistics(EntryStatistics _es)
Sets entry statistics.- Overrides:
setEntryStatisticsin classWeightingModel
-
getInfo
public java.lang.String getInfo()
Returns the name of the model.- Specified by:
getInfoin interfaceModel- Specified by:
getInfoin classWeightingModel- Returns:
- java.lang.String
-
score
public double score(double tf, double docLength)Description copied from class:WeightingModelThis method provides the contract for implementing weighting models.- Specified by:
scorein 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
-
-