/** * 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. Conservative Query Expansion (ConservativeQE) is used if * the number of expanded terms is set to 0. In this case, no new query terms * are added to the query, only the existing ones reweighted. * @param 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. */ public SingleTermQuery[] getExpandedTerms(int numberOfExpandedTerms) { return getExpandedTerms(numberOfExpandedTerms, model); }
/** * Returns the un-normalised weight of a given term. * @param term String the given term. * @return The un-normalised term weight. */ public double getOriginalExpansionWeight(String term){ return getExpansionWeight(term)*normaliser; }
/** * Adds the feedback document to the feedback set. */ public void insertDocument(FeedbackDocument doc) throws IOException { insertDocument(doc.docid, doc.rank, doc.score); } /**
/** * Returns the frequency of a given term in the top-ranked documents. * @param term String the term to get the frequency for. * @return double the frequency of the specified term in the top-ranked documents. */ public double getFrequency(String term){ return this.getFrequency(lexicon.getLexiconEntry(term).getTermId()); }
/** * Adds the feedback document from the index given a docid */ public void insertDocument(int docid, int rank, double score) throws IOException { totalDocumentLength += documentIndex.getDocumentLength(docid); final IterablePosting ip = directIndex.getPostings((BitIndexPointer)documentIndex.getDocumentEntry(docid)); if (ip == null) { logger.warn("document id "+docid+" not found"); return; } while(ip.next() != IterablePosting.EOL) { this.insertTerm(ip.getId(), ip.getFrequency()); } feedbackDocumentCount++; }
protected SingleTermQuery[] getExpandedTerms(int numberOfExpandedTerms, QueryExpansionModel QEModel) { assignWeights(QEModel);
/** * Returns the frequency of a given term in the top-ranked documents. * @param term String the term to get the frequency for. * @return double the frequency of the specified term in the top-ranked documents. */ public double getFrequency(String term){ return this.getFrequency(lexicon.getLexiconEntry(term).getTermId()); }
/** * Adds the feedback document from the index given a docid */ public void insertDocument(int docid, int rank, double score) throws IOException { totalDocumentLength += documentIndex.getDocumentLength(docid); final IterablePosting ip = directIndex.getPostings((BitIndexPointer)documentIndex.getDocumentEntry(docid)); if (ip == null) { logger.warn("document id "+docid+" not found"); return; } while(ip.next() != IterablePosting.EOL) { this.insertTerm(ip.getId(), ip.getFrequency()); } feedbackDocumentCount++; }
protected SingleTermQuery[] getExpandedTerms(int numberOfExpandedTerms, QueryExpansionModel QEModel) { assignWeights(QEModel);
/** * Returns the un-normalised weight of a given term. * @param term String the given term. * @return The un-normalised term weight. */ public double getOriginalExpansionWeight(String term){ return getExpansionWeight(term)*normaliser; }
/** * Adds the feedback document to the feedback set. */ public void insertDocument(FeedbackDocument doc) throws IOException { insertDocument(doc.docid, doc.rank, doc.score); } /**
/** * 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. Conservative Query Expansion (ConservativeQE) is used if * the number of expanded terms is set to 0. In this case, no new query terms * are added to the query, only the existing ones reweighted. * @param 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. */ public SingleTermQuery[] getExpandedTerms(int numberOfExpandedTerms) { return getExpandedTerms(numberOfExpandedTerms, model); }
/** * Returns the weight of a given term, computed by the * specified query expansion model. * @param term String the term to set the weight for. * @param model QueryExpansionModel the used query expansion model. * @return double the weight of the specified term. */ public double getExpansionWeight(String term, QueryExpansionModel model) { return this.getExpansionWeight(lexicon.getLexiconEntry(term).getTermId(), model); }
/** * Returns the weight of a given term, computed by the * specified query expansion model. * @param term String the term to set the weight for. * @param model QueryExpansionModel the used query expansion model. * @return double the weight of the specified term. */ public double getExpansionWeight(String term, QueryExpansionModel model) { return this.getExpansionWeight(lexicon.getLexiconEntry(term).getTermId(), model); }
/** * Returns the weight of a given term. * @param term String the term to get the weight for. * @return double the weight of the specified term. */ public double getExpansionWeight(String term) { return this.getExpansionWeight(lexicon.getLexiconEntry(term).getTermId(), model); } /**
/** * Returns the weight of a given term. * @param term String the term to get the weight for. * @return double the weight of the specified term. */ public double getExpansionWeight(String term) { return this.getExpansionWeight(lexicon.getLexiconEntry(term).getTermId(), model); } /**