Class WeightingModel

    • Field Detail

      • i

        protected Idf i
        The class used for computing the idf values.
      • averageDocumentLength

        protected double averageDocumentLength
        The average length of documents in the collection.
      • keyFrequency

        protected double keyFrequency
        The term frequency in the query.
      • documentFrequency

        protected double documentFrequency
        The document frequency of the term in the collection.
      • termFrequency

        protected double termFrequency
        The term frequency in the collection.
      • numberOfDocuments

        protected double numberOfDocuments
        The number of documents in the collection.
      • numberOfTokens

        protected double numberOfTokens
        The number of tokens in the collections.
      • c

        protected double c
        The parameter c. This defaults to 1.0, but should be set using in the constructor of each child weighting model to the sensible default for that weighting model.
      • numberOfUniqueTerms

        protected double numberOfUniqueTerms
        Number of unique terms in the collection
      • numberOfPointers

        @Deprecated
        protected double numberOfPointers
        Deprecated.
        The number of distinct entries in the inverted file. This figure can be calculated as the sum of all Nt over all terms. Deprecated in favour of numberOfPostings
      • numberOfPostings

        protected double numberOfPostings
        The number of distinct entries in the inverted file. This figure can be calculated as the sum of all Nt over all terms
    • Constructor Detail

      • WeightingModel

        public WeightingModel()
        A default constructor that initialises the idf i attribute
    • Method Detail

      • clone

        public WeightingModel clone()
        Clone this weighting model
        Overrides:
        clone in class java.lang.Object
      • getInfo

        public abstract java.lang.String getInfo()
        Returns the name of the model.
        Specified by:
        getInfo in interface Model
        Returns:
        java.lang.String
      • prepare

        public void prepare()
        prepare
      • getOverflowed

        public static long getOverflowed​(int o)
        Returns overflow
        Parameters:
        o -
        Returns:
        overflow
      • score

        public double score​(Posting p)
        Returns score
        Parameters:
        p -
        Returns:
        score
      • setCollectionStatistics

        public void setCollectionStatistics​(CollectionStatistics _cs)
        Sets collection statistics
        Parameters:
        _cs -
      • setEntryStatistics

        public void setEntryStatistics​(EntryStatistics _es)
        Sets entry statistics.
        Parameters:
        _es -
      • setRequest

        public void setRequest​(Request _rq)
        Sets request
        Parameters:
        _rq -
      • score

        public abstract double score​(double tf,
                                     double docLength)
        This method provides the contract for implementing weighting models.
        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 _c)
        Sets the c value
        Specified by:
        setParameter in interface Model
        Parameters:
        _c - the term frequency normalisation parameter value.
      • getParameter

        public double getParameter()
        Returns the parameter as set by setParameter()
        Specified by:
        getParameter in interface Model
      • setKeyFrequency

        public void setKeyFrequency​(double keyFreq)
        Sets the term's frequency in the query.
        Parameters:
        keyFreq - the term's frequency in the query.