Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

TextQueryRetMethod.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  *
00003  *  Original source copyright (c) 2001, Carnegie Mellon University.
00004  *  See copyright.cmu for details.
00005  *  Modifications copyright (c) 2002, University of Massachusetts.
00006  *  See copyright.umass for details.
00007  *
00008  *==========================================================================
00009 */
00010 
00011 
00012 #ifndef _TEXTQUERYRETMETHOD_HPP
00013 #define _TEXTQUERYRETMETHOD_HPP
00014 
00015 
00016 #include "RetrievalMethod.hpp"
00017 #include "TextQueryRep.hpp"
00018 #include "DocumentRep.hpp"
00019 #include "ScoreFunction.hpp"
00020 #include "ScoreAccumulator.hpp"
00021 #include "FreqVector.hpp"
00022 
00023 //----------------------------------------------------------------------
00024 //      Abstract Interface for A Retrieval Method/Model for Text Query
00025 //----------------------------------------------------------------------
00026 
00074 class TextQueryRetMethod : public RetrievalMethod {
00075 public:
00078   TextQueryRetMethod(Index &ind, ScoreAccumulator & accumulator);
00081   virtual ~TextQueryRetMethod() {
00082     if (cacheDocReps) {
00083       for (int i = 0; i < docRepsSize; i++) delete(docReps[i]);
00084       delete[](docReps);
00085     }
00086   }
00087 
00089   virtual TextQueryRep *computeTextQueryRep(TextQuery &qry)=0;
00091   virtual TextQueryRep *computeTextQueryRep(int docid){
00092     return NULL; 
00093   } // need to implement for other ret methods.
00095   virtual QueryRep *computeQueryRep(Query &qry); 
00096 
00098   virtual double scoreDoc(QueryRep &qry, int docID);
00100   virtual void scoreCollection(QueryRep &qry, IndexedRealVector &results);
00102   virtual void scoreCollection(int docid, IndexedRealVector &results);
00103   
00105   virtual DocumentRep *computeDocRep(int docID) =0;
00107   virtual ScoreFunction *scoreFunc() = 0;
00109   virtual void updateQuery(QueryRep &qryRep, DocIDSet &relDocs) {
00110     updateTextQuery(*((TextQueryRep *)(&qryRep)), relDocs);
00111   }
00112 
00114   virtual void updateTextQuery(TextQueryRep &qryRep, DocIDSet &relDocs)=0;
00115 
00117 
00120   virtual void scoreInvertedIndex(QueryRep &qryRep, IndexedRealVector &scores, bool scoreAll=false);
00121 
00122   virtual double scoreDocVector(TextQueryRep &qry, int docID, FreqVector &docVector);
00123 
00124 protected:
00125   ScoreAccumulator &scAcc;
00127   DocumentRep **docReps;
00129   bool cacheDocReps;
00131   int docRepsSize;
00132 };
00133 
00134 
00135 //=============== inlines ========================================
00136 
00137 inline QueryRep *TextQueryRetMethod::computeQueryRep(Query &qry) { 
00138   TextQuery *q = static_cast<TextQuery *>(&qry);
00139   return (computeTextQueryRep(*q));
00140 }
00141 
00142 #endif /* _TEXTQUERYRETMETHOD_HPP */
00143 
00144 
00145 
00146 

Generated on Fri Feb 6 07:11:50 2004 for LEMUR by doxygen1.2.16