public class DFRBagExpansionTerms extends ExpansionTerms
Properties:
ExpansionTerms.ExpansionTerm
Modifier and Type | Field and Description |
---|---|
protected double |
averageDocumentLength
The average document length in the collection.
|
protected PostingIndex<?> |
directIndex |
protected DocumentIndex |
documentIndex |
protected int |
feedbackDocumentCount |
protected Lexicon<String> |
lexicon
The lexicon used for retrieval.
|
protected static org.slf4j.Logger |
logger
The logger used
|
double |
normaliser
The parameter-free term weight normaliser.
|
protected int |
numberOfDocuments
The number of documents in the collection.
|
protected long |
numberOfTokens
The number of tokens in the collection.
|
protected gnu.trove.TIntObjectHashMap<ExpansionTerms.ExpansionTerm> |
terms
The terms in the top-retrieval documents.
|
protected double |
totalDocumentLength
The number of tokens in the X top ranked documents.
|
EXPANSIONTERM_DESC_SCORE_SORTER, model, originalTermFreqs, originalTermids
Constructor and Description |
---|
DFRBagExpansionTerms(CollectionStatistics collStats,
Lexicon<String> _lexicon,
PostingIndex<?> _directIndex,
DocumentIndex _documentIndex)
Constructs an instance of ExpansionTerms.
|
Modifier and Type | Method and Description |
---|---|
void |
assignWeights(QueryExpansionModel QEModel)
Assign weight to terms that are stored in ExpansionTerm[] terms.
|
void |
deleteTerm(int termid)
Remove the records for a given term
|
double |
getDocumentFrequency(int termId)
Returns the number of the top-ranked documents a given term occurs in.
|
SingleTermQuery[] |
getExpandedTerms(int numberOfExpandedTerms)
This method implements the functionality of assigning expansion weights to
the terms in the top-retrieved documents, and returns the most informative
terms among them.
|
protected SingleTermQuery[] |
getExpandedTerms(int numberOfExpandedTerms,
QueryExpansionModel QEModel) |
double |
getExpansionProbability(int termId)
Returns the probability of a given termid occurring
in the expansion documents.
|
gnu.trove.TIntObjectHashMap<ExpansionTerms.ExpansionTerm> |
getExpansionTerms()
Returns expanded terms
|
double |
getExpansionWeight(int termId)
Returns the weight of a term with the given
term identifier.
|
double |
getExpansionWeight(int termId,
QueryExpansionModel model)
Returns the weight of a term with the given
term identifier, computed by the specified
query expansion model.
|
double |
getExpansionWeight(String term)
Returns the weight of a given term.
|
double |
getExpansionWeight(String term,
QueryExpansionModel model)
Returns the weight of a given term, computed by the
specified query expansion model.
|
double |
getFrequency(int termId)
Returns the frequency of a given term in the top-ranked documents.
|
double |
getFrequency(String term)
Returns the frequency of a given term in the top-ranked documents.
|
int |
getNumberOfUniqueTerms()
Returns the unique number of terms found in all the top-ranked documents
|
double |
getOriginalExpansionWeight(String term)
Returns the un-normalised weight of a given term.
|
int[] |
getTermIds()
Returns the termids of all terms found in the top-ranked documents
|
void |
insertDocument(FeedbackDocument doc)
Adds the feedback document to the feedback set.
|
void |
insertDocument(int docid,
int rank,
double score)
Adds the feedback document from the index given a docid
|
protected void |
insertTerm(int termID,
double withinDocumentFrequency)
Add a term in the X top-retrieved documents as a candidate of the
expanded terms.
|
void |
setTotalDocumentLength(double totalLength)
Allows the totalDocumentLength to be set after the fact
|
setModel, setOriginalQueryTerms
protected static org.slf4j.Logger logger
protected gnu.trove.TIntObjectHashMap<ExpansionTerms.ExpansionTerm> terms
protected PostingIndex<?> directIndex
protected DocumentIndex documentIndex
protected int numberOfDocuments
protected long numberOfTokens
protected double averageDocumentLength
protected double totalDocumentLength
public double normaliser
protected int feedbackDocumentCount
public DFRBagExpansionTerms(CollectionStatistics collStats, Lexicon<String> _lexicon, PostingIndex<?> _directIndex, DocumentIndex _documentIndex)
collStats
- Statistics of the used corpora_lexicon
- Lexicon The lexicon used for retrieval._directIndex
- DirectIndex to use for finding terms for documents_documentIndex
- DocumentIndex to use for finding statistics about documentspublic void setTotalDocumentLength(double totalLength)
public int[] getTermIds()
public int getNumberOfUniqueTerms()
getNumberOfUniqueTerms
in class ExpansionTerms
public gnu.trove.TIntObjectHashMap<ExpansionTerms.ExpansionTerm> getExpansionTerms()
public SingleTermQuery[] getExpandedTerms(int numberOfExpandedTerms)
getExpandedTerms
in class ExpansionTerms
numberOfExpandedTerms
- int The number of terms to extract from the
top-retrieved documents. ConservativeQE is set if this parameter is set to 0.
* @return TermTreeNode[] The expanded terms.protected SingleTermQuery[] getExpandedTerms(int numberOfExpandedTerms, QueryExpansionModel QEModel)
public void deleteTerm(int termid)
public double getExpansionWeight(String term, QueryExpansionModel model)
term
- String the term to set the weight for.model
- QueryExpansionModel the used query expansion model.public double getExpansionWeight(String term)
term
- String the term to get the weight for.public double getOriginalExpansionWeight(String term)
term
- String the given term.public double getFrequency(String term)
term
- String the term to get the frequency for.public double getFrequency(int termId)
termId
- int the id of the term to get the frequency for.public double getDocumentFrequency(int termId)
termId
- int the id of the term to get the frequency for.public void assignWeights(QueryExpansionModel QEModel)
QEModel
- QueryExpansionModel the used query expansion model.public double getExpansionWeight(int termId, QueryExpansionModel model)
termId
- int the term identifier to set the weight for.model
- QueryExpansionModel the used query expansion model.public double getExpansionWeight(int termId)
termId
- int the term identifier to set the weight for.public double getExpansionProbability(int termId)
termId
- int the term identifier to obtain the probabilitypublic void insertDocument(FeedbackDocument doc) throws IOException
insertDocument
in class ExpansionTerms
IOException
public void insertDocument(int docid, int rank, double score) throws IOException
IOException
protected void insertTerm(int termID, double withinDocumentFrequency)
termID
- int the integer identifier of a termwithinDocumentFrequency
- double the within document
frequency of a termTerrier Information Retrieval Platform 5.1. Copyright © 2004-2019, University of Glasgow