00001 /*========================================================================== 00002 * Copyright (c) 2001 Carnegie Mellon University. All Rights Reserved. 00003 * 00004 * Use of the Lemur Toolkit for Language Modeling and Information Retrieval 00005 * is subject to the terms of the software license set forth in the LICENSE 00006 * file included with this software, and also available at 00007 * http://www.cs.cmu.edu/~lemur/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 00013 #ifndef _RETRIEVALMETHOD_HPP 00014 #define _RETRIEVALMETHOD_HPP 00015 00016 00017 #include "Index.hpp" 00018 #include "WeightedIDSet.hpp" 00019 #include "IndexedReal.hpp" 00020 00021 00022 //------------------------------------------------------------ 00023 // Abstract Interface for A Query 00024 //------------------------------------------------------------ 00025 00027 class Query { 00028 public: 00029 virtual char *id() = 0; 00030 }; 00031 00033 00034 class QueryRep { 00035 public: 00036 virtual ~QueryRep(){} 00037 }; 00038 00039 00040 //------------------------------------------------------------ 00041 // Abstract Interface for Feedback Document Subset 00042 //------------------------------------------------------------ 00043 00045 typedef WeightedIDSet DocIDSet; 00046 00047 00048 //------------------------------------------------------------ 00049 // Abstract Interface for A Retrieval Method/Model 00050 //------------------------------------------------------------ 00051 00052 00053 00064 class RetrievalMethod { 00065 public: 00066 RetrievalMethod(Index &collectionIndex) : ind(collectionIndex) {} 00067 virtual ~RetrievalMethod() {} 00068 00070 virtual QueryRep *computeQueryRep(Query &qry)=0; 00071 00073 virtual double scoreDoc(QueryRep &qry, int docID)=0; 00074 00076 00079 virtual void scoreDocSet(QueryRep &qry, DocIDSet &docSet, IndexedRealVector &results); 00080 00082 00089 virtual void scoreCollection(QueryRep &qry, IndexedRealVector &results); 00090 00092 virtual void updateQuery(QueryRep &qryRep, DocIDSet &relDocs) = 0; 00093 00094 protected: 00095 Index &ind; 00096 }; 00097 00098 #endif /* _RETRIEVALMETHOD_HPP */ 00099 00100 00101 00102 00103 00104 00105 00106 00107