Ejemplo n.º 1
0
// the most general, but probably also most inefficient implementation
void lemur::api::RetrievalMethod::scoreCollection(const QueryRep &qry, IndexedRealVector &results)
{
  results.clear();
  for (DOCID_T id=1; id<=ind.docCount();id++) {
    results.PushValue(id, scoreDoc(qry, id));
  }
}
Ejemplo n.º 2
0
/// Score a set of documents w.r.t. a query rep (e.g. for re-ranking)
void lemur::api::RetrievalMethod::scoreDocSet(const QueryRep &qry, const DocIDSet &docSet, IndexedRealVector &results)
{
  results.clear();
  docSet.startIteration();
  while (docSet.hasMore()) {
    int docID;
    double prevScore;
    docSet.nextIDInfo(docID, prevScore);
    results.PushValue(docID, scoreDoc(qry, docID));
  }
}
Ejemplo n.º 3
0
/** Score a set of documents w.r.t. a query rep (e.g. for re-ranking) */
void LinkDistributionRetMethod::scoreDocSet(const QueryRep &qry, const DocIDSet &docSet, IndexedRealVector &results)
{
	results.clear();
	docSet.startIteration();

	while(docSet.hasMore())
	{
		int docID;
		double prevScore;
		docSet.nextIDInfo(docID, prevScore);
		
		double phi = lemur::api::ParamGetDouble("phi", 0);
		double currentScore = (1 - phi) * prevScore + phi * scoreDoc(qry, docID);
		results.PushValue(docID, currentScore);
	}//while
}//end scoreDocSet
Ejemplo n.º 4
0
void LinkDistributionRetMethod::scoreDocSet(const Query &q, const DocIDSet &docSet, IndexedRealVector &results)
{
	//assert(LinkDistributionParameter::docWindowSize>0);

	results.clear();
	docSet.startIteration();
	while(docSet.hasMore())
	{
		int docID;
		double prevScore;
		docSet.nextIDInfo(docID, prevScore);
		//cerr<<"docID:"<<docID<<endl;
		double phi = lemur::api::ParamGetDouble("phi", 0);
		double currentScore = (1 - phi) * prevScore + phi * scoreDoc(q, docID);
		results.PushValue(docID, currentScore);
	}//while

}
Ejemplo n.º 5
0
void lemur::api::StructQueryRetMethod::scoreInvertedIndex(const QueryRep &qRep, 
                                                          IndexedRealVector &scores, 
                                                          bool scoreAll) {
  COUNT_T numDocs = ind.docCount();
  COUNT_T i;
  lemur::retrieval::QueryNode *queryRoot = ((lemur::retrieval::StructQueryRep *)(&qRep))->topnode();
  scores.clear();  
  // eval the query
  StructQueryScoreFunc * scorer = (StructQueryScoreFunc *)scoreFunc();
  for (i = 1; i <= numDocs; i++) {
    if (queryRoot->dList[i]) {
      DocumentRep *dRep = computeDocRep(i);
      scores.PushValue(i, scorer->evalQuery(queryRoot, dRep));
      delete dRep;
    } else if (scoreAll) {
      scores.PushValue(i, scorer->adjustedScore(0, queryRoot));
    }
  }
}