Package org.terrier.querying
Class ExpansionTerms
- java.lang.Object
-
- org.terrier.querying.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExpansionTerms.ExpansionTerm
This class implements a data structure for a term in the top-retrieved documents.
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.Comparator<ExpansionTerms.ExpansionTerm>
EXPANSIONTERM_DESC_SCORE_SORTER
protected static org.slf4j.Logger
logger
protected QueryExpansionModel
model
protected gnu.trove.TIntDoubleHashMap
originalTermFreqs
The frequency of each query term in the original query.protected gnu.trove.TIntObjectHashMap<java.lang.String>
originalTermids
The original query terms.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ExpansionTerms()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract SingleTermQuery[]
getExpandedTerms(int numberOfExpandedTerms)
Get the most informative terms for the expanded set.abstract int
getNumberOfUniqueTerms()
Returns the number of terms being consideredint[]
getOriginalTermIds()
Returns the termids for the original queryabstract void
insertDocument(FeedbackDocument doc)
Add a single document to be considered for expanding the queryvoid
setModel(QueryExpansionModel m)
Set query expansion modelvoid
setOriginalQueryTerms(MatchingQueryTerms query)
Set the original query terms.
-
-
-
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.
-
model
protected QueryExpansionModel model
-
-
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
-
-