Class Normalisation
- java.lang.Object
-
- org.terrier.matching.models.normalisation.Normalisation
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
- Direct Known Subclasses:
Normalisation0,Normalisation1,Normalisation2,Normalisation2exp,Normalisation3,NormalisationB,NormalisationF,NormalisationJ,NormalisationJN,NormalisationP,NormalisationStatic
public abstract class Normalisation extends java.lang.Object implements java.io.Serializable, java.lang.CloneableThis class provides a contract for implementing frequency normalisation methods. Properties- field.retrieval - A boolean variable that indicates if field-retrieval is enabled. This allows for further extension with retrieval over different fields.
- Author:
- Ben He
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected doubleaverageDocumentLengthThe average document length in the collection.protected IdfidfThe class used for computing the logorithm values.protected doubleNtThe document frequency of the term.protected doublenumberOfDocumentsThe number of documents in the whole collection.protected doublenumberOfTokensThe number of tokens in the whole collection.protected doubleparameterThe free parameter of the normalisation method.protected doubletermFrequencyThe frequency of the query term in the whole collection.
-
Constructor Summary
Constructors Constructor Description Normalisation()The default constructor.Normalisation(double value)The constructor that specifies the parameter value.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Normalisationclone()Clone this weighting modelabstract java.lang.StringgetInfo()This method provides the contract for getting the name of the implemented frequency normalisation method.doublegetParameter()Returns the hyper-parameter value.abstract doublenormalise(double tf, double docLength, double _termFrequency)This method provides the contract for implementing the frequency normalisation formula.voidsetAverageDocumentLength(double value)Set the average document length in the collection.voidsetDocumentFrequency(double nt)voidsetNumberOfDocuments(double _numberOfDocuments)voidsetNumberOfTokens(double value)Set the number of tokens in the collection.voidsetParameter(double value)Specify the free parameter of the implemented frequency normalisation method.
-
-
-
Field Detail
-
averageDocumentLength
protected double averageDocumentLength
The average document length in the collection.
-
idf
protected Idf idf
The class used for computing the logorithm values.
-
termFrequency
protected double termFrequency
The frequency of the query term in the whole collection.
-
parameter
protected double parameter
The free parameter of the normalisation method.
-
numberOfTokens
protected double numberOfTokens
The number of tokens in the whole collection.
-
Nt
protected double Nt
The document frequency of the term.
-
numberOfDocuments
protected double numberOfDocuments
The number of documents in the whole collection.
-
-
Method Detail
-
clone
public Normalisation clone()
Clone this weighting model- Overrides:
clonein classjava.lang.Object
-
setAverageDocumentLength
public void setAverageDocumentLength(double value)
Set the average document length in the collection.- Parameters:
value- The average document length in the collection.
-
setNumberOfTokens
public void setNumberOfTokens(double value)
Set the number of tokens in the collection.- Parameters:
value- The number of tokens in the collection.
-
setParameter
public void setParameter(double value)
Specify the free parameter of the implemented frequency normalisation method.- Parameters:
value- The specified value of the frequency normalisation parameter.
-
getParameter
public double getParameter()
Returns the hyper-parameter value.- Returns:
- The hyper-parameter value.
-
getInfo
public abstract java.lang.String getInfo()
This method provides the contract for getting the name of the implemented frequency normalisation method.- Returns:
- The name of the implemented frequency normalisation method.
-
normalise
public abstract double normalise(double tf, double docLength, double _termFrequency)This method provides the contract for implementing the frequency normalisation formula.- Parameters:
tf- The frequency of the query term in the document.docLength- The number of tokens in the document._termFrequency- The frequency of the query term in the collection.- Returns:
- The normalised term frequency.
-
setDocumentFrequency
public void setDocumentFrequency(double nt)
- Parameters:
nt- the document frequency to set
-
setNumberOfDocuments
public void setNumberOfDocuments(double _numberOfDocuments)
- Parameters:
_numberOfDocuments- the numberOfDocuments to set
-
-