Class Tf

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Model

    public class Tf
    extends WeightingModel
    This class implements a simple Tf weighting model.
    Since:
    4.0
    Author:
    Craig Macdonald
    See Also:
    Serialized Form
    • Constructor Detail

      • Tf

        public Tf()
      • Tf

        public Tf​(double b)
    • Method Detail

      • getInfo

        public final java.lang.String getInfo()
        Description copied from class: WeightingModel
        Returns the name of the model.
        Specified by:
        getInfo in interface Model
        Specified by:
        getInfo in class WeightingModel
        Returns:
        java.lang.String
      • score

        public final double score​(double tf,
                                  double docLength)
        Description copied from class: WeightingModel
        This method provides the contract for implementing weighting models.
        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
      • setParameter

        public void setParameter​(double b)
        Sets the b parameter to ranking formula
        Specified by:
        setParameter in interface Model
        Overrides:
        setParameter in class WeightingModel
        Parameters:
        b - the b parameter value to use.
      • getParameter

        public double getParameter()
        Returns the b parameter to the ranking formula as set by setParameter()
        Specified by:
        getParameter in interface Model
        Overrides:
        getParameter in class WeightingModel