Class ExpansionTerms

  • Direct Known Subclasses:
    DFRBagExpansionTerms

    public abstract class ExpansionTerms
    extends java.lang.Object
    Base class for weighting term occurrences in feedback documents.
    Since:
    3.0
    Author:
    Craig Macdonald
    • Field Detail

      • logger

        protected static final org.slf4j.Logger logger
      • EXPANSIONTERM_DESC_SCORE_SORTER

        protected static final java.util.Comparator<ExpansionTerms.ExpansionTerm> EXPANSIONTERM_DESC_SCORE_SORTER
      • originalTermids

        protected gnu.trove.TIntObjectHashMap<java.lang.String> originalTermids
        The original query terms. Used only for Conservative Query Expansion, where no terms are added to the query, only the existing ones are reweighted.
      • originalTermFreqs

        protected gnu.trove.TIntDoubleHashMap originalTermFreqs
        The frequency of each query term in the original query. Currently used by RM3 only.
    • Constructor Detail

      • ExpansionTerms

        protected ExpansionTerms()
    • Method Detail

      • setOriginalQueryTerms

        public void setOriginalQueryTerms​(MatchingQueryTerms query)
        Set the original query terms.
        Parameters:
        query - The original query.
      • getOriginalTermIds

        public int[] getOriginalTermIds()
        Returns the termids for the original query
      • insertDocument

        public abstract void insertDocument​(FeedbackDocument doc)
                                     throws java.io.IOException
        Add a single document to be considered for expanding the query
        Throws:
        java.io.IOException
      • getExpandedTerms

        public abstract SingleTermQuery[] getExpandedTerms​(int numberOfExpandedTerms)
        Get the most informative terms for the expanded set.
        Parameters:
        numberOfExpandedTerms - - number of terms to get.
        Returns:
        weighted query terms
      • setModel

        public void setModel​(QueryExpansionModel m)
        Set query expansion model
        Parameters:
        m -
      • getNumberOfUniqueTerms

        public abstract int getNumberOfUniqueTerms()
        Returns the number of terms being considered