Terrier IR Platform
2.2.1

uk.ac.gla.terrier.matching.models
Class DFRWeightingModel

java.lang.Object
  extended by uk.ac.gla.terrier.matching.models.WeightingModel
      extended by uk.ac.gla.terrier.matching.models.DFRWeightingModel
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Model

public class DFRWeightingModel
extends WeightingModel

This class implements a modular DFR model. Components in the model are specified individually. Besides of the basic model, the other two components can be either specified or disabled.

Version:
$Revision: 1.24 $
Author:
Ben He
See Also:
Serialized Form

Constructor Summary
DFRWeightingModel(java.lang.String[] components)
          The default constructor.
 
Method Summary
 java.lang.String getInfo()
          Returns the name of the model.
 double getParameter()
          Return the parameter set by setParameter()
 double score(double tf, double docLength)
          Compute a weight for a term in a document.
 double score(double tf, double docLength, double documentFrequency, double termFrequency, double queryTermWeight)
          Compute a weight for a term in a document.
 void setAverageDocumentLength(double avgDocLength)
          Sets the average length of documents in the collection.
 void setDocumentFrequency(double docFreq)
          Sets the document frequency of the term in the collection.
 void setNumberOfDocuments(double numOfDocs)
          Sets the number of documents in the collection.
 void setNumberOfTokens(double value)
          Set the number of tokens in the collection.
 void setNumberOfUniqueTerms(double number)
          Set the number of unique terms in the collection.
 void setParameter(double value)
          Set the frequency normalisation parameter.
 
Methods inherited from class uk.ac.gla.terrier.matching.models.WeightingModel
clone, setKeyFrequency, setNumberOfPointers, setTermFrequency, stirlingPower
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DFRWeightingModel

public DFRWeightingModel(java.lang.String[] components)
The default constructor. Takes an array of strings to define the Basic Model, the After Effect component and the Normalisation component. If the array is less than 3 items in length, then empty strings will be passed instead of the After Effect and/or Normalisation components.

Parameters:
components - Corresponds to the names of the 3 DFR weighting models component names, as passed to initialise().
Method Detail

setAverageDocumentLength

public void setAverageDocumentLength(double avgDocLength)
Sets the average length of documents in the collection.

Specified by:
setAverageDocumentLength in interface Model
Overrides:
setAverageDocumentLength in class WeightingModel
Parameters:
avgDocLength - The documents' average length.

setNumberOfDocuments

public void setNumberOfDocuments(double numOfDocs)
Sets the number of documents in the collection.

Specified by:
setNumberOfDocuments in interface Model
Overrides:
setNumberOfDocuments in class WeightingModel
Parameters:
numOfDocs - the number of documents in the collection.

setNumberOfTokens

public void setNumberOfTokens(double value)
Set the number of tokens in the collection.

Specified by:
setNumberOfTokens in interface Model
Overrides:
setNumberOfTokens in class WeightingModel
Parameters:
value - The number of tokens in the collection.

setNumberOfUniqueTerms

public void setNumberOfUniqueTerms(double number)
Set the number of unique terms in the collection.

Specified by:
setNumberOfUniqueTerms in interface Model
Overrides:
setNumberOfUniqueTerms in class WeightingModel
Parameters:
number - double The number of unique terms in the collection.

setParameter

public void setParameter(double value)
Set the frequency normalisation parameter.

Specified by:
setParameter in interface Model
Overrides:
setParameter in class WeightingModel
Parameters:
value - The given parameter value.

getParameter

public double getParameter()
Return the parameter set by setParameter()

Specified by:
getParameter in interface Model
Overrides:
getParameter in class WeightingModel
Returns:
parameter double value

getInfo

public final java.lang.String getInfo()
Returns the name of the model.

Specified by:
getInfo in interface Model
Specified by:
getInfo in class WeightingModel
Returns:
The name of the model.

setDocumentFrequency

public void setDocumentFrequency(double docFreq)
Sets the document frequency of the term in the collection.

Overrides:
setDocumentFrequency in class WeightingModel
Parameters:
docFreq - the document frequency of the term in the collection.

score

public final double score(double tf,
                          double docLength)
Compute a weight for a term in a document.

Specified by:
score in class WeightingModel
Parameters:
tf - The term frequency in the document
docLength - the document's length
Returns:
the score assigned to a document with the given tf and docLength, and other preset parameters

score

public final double score(double tf,
                          double docLength,
                          double documentFrequency,
                          double termFrequency,
                          double queryTermWeight)
Compute a weight for a term in a document.

Specified by:
score in class WeightingModel
Parameters:
tf - The term frequency in the document
docLength - the document's length
documentFrequency - The document frequency of the term
termFrequency - the term frequency in the collection
queryTermWeight - the term frequency in the query
Returns:
the score assigned by the weighting model PL2.

Terrier IR Platform
2.2.1

Terrier Information Retrieval Platform 2.2.1. Copyright 2004-2008 University of Glasgow