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

ResultFile.hpp

Go to the documentation of this file.
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 _RESULTFILE_HPP
00014 #define _RESULTFILE_HPP
00015 
00016 #include "common_headers.hpp"
00017 #include "Index.hpp"
00018 #include "IndexedReal.hpp"
00019 #include "ISet.hpp"
00020 #include "String.hpp"
00021 
00023 struct ResultEntry {
00024 public:
00025   String key;
00026   unsigned int Hash() const { return key.Hash();}
00027   unsigned int hash() const { return Hash();} 
00028   bool operator==(const ResultEntry entry) { return (entry.key ==  this->key);}  IndexedRealVector *res;
00029 };
00030 
00032 
00033 class ResultFile {
00034 public:
00035   ResultFile(bool TRECFormat = true) : trecFmt (TRECFormat), resTable(NULL) {
00036     resTable = new ISet<ResultEntry>(50);
00037   }
00038   
00039   ~ResultFile() { delete resTable;}
00040 
00042   void openForRead(istream &is, Index &index);
00043   
00045   void load(istream &is, Index &index);
00046 
00048   void getResult(char *expectedQID, IndexedRealVector &res);
00049 
00051   bool findResult(char *queryID, IndexedRealVector *&res);
00052   
00054   void openForWrite( ostream &os, Index &index) {
00055     
00056     outStr = &os;
00057     ind = &index;
00058   }
00059 
00061 
00062   void writeResults(char *queryID, IndexedRealVector *results, int maxCountOfResult);
00063   
00064 private:
00065 
00066   bool readLine();
00067 
00068   bool trecFmt;
00069 
00070   char curQID[300];
00071   char curDID[300];
00072   double curSC;
00073   Index *ind;
00074   istream *inStr;
00075   ostream *outStr;
00076   bool eof;
00077 
00078   ISet<ResultEntry> * resTable;
00079 
00080 };
00081 
00082 
00083 #endif /* _RESULTFILE_HPP */
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 

Generated at Fri Jul 26 18:22:27 2002 for LEMUR by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000