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

ContextCountAccumulator.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2004 University of Massachusetts.  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.lemurproject.org/license.html
00008  *
00009  *==========================================================================
00010  */
00011 
00012 
00013 //
00014 // ContextCountAccumulator
00015 //
00016 // 24 February 2004 -- tds
00017 //
00018 
00019 #ifndef INDRI_CONTEXTCOUNTACCUMULATOR_HPP
00020 #define INDRI_CONTEXTCOUNTACCUMULATOR_HPP
00021 
00022 #include "indri/ListIteratorNode.hpp"
00023 #include "lemur-platform.h"
00024 #include "lemur-compat.hpp"
00025 #include <vector>
00026 #include "indri/EvaluatorNode.hpp"
00027 #include "indri/QuerySpec.hpp"
00028 #include "indri/DocumentCount.hpp"
00029 namespace indri
00030 {
00031   namespace infnet
00032   {
00033     
00034     class ContextCountAccumulator : public EvaluatorNode {
00035     private:
00036       // this is a ListIteratorNode that contains extents
00037       // that compose the context of the operation. _contextSize
00038       // is the sum of the lengths of the extents in _context.
00039       ListIteratorNode* _context;
00040 
00041       // this is a ListIteratorNode that emits an extent only for a
00042       // true query match; therefore _occurrences is just a simple count
00043       // the number of extents in _matches.
00044       ListIteratorNode* _matches; 
00045 
00046       std::string _name;
00047   double _occurrences;
00048   double _contextSize;
00049       int _documentOccurrences;
00050       int _documentCount;
00051       
00052       EvaluatorNode::MResults _results;
00053 
00054 public:
00055       ContextCountAccumulator( const std::string& name, ListIteratorNode* matches, ListIteratorNode* context );
00056       ~ContextCountAccumulator();
00057 
00058   double getOccurrences() const;
00059   double getContextSize() const;
00060 
00061       int getDocumentOccurrences() const ;
00062       int getDocumentCount() const ;
00063 
00064       const ListIteratorNode* getContextNode() const;
00065       const ListIteratorNode* getMatchesNode() const;
00066       const std::string& getName() const;
00067 
00068       const EvaluatorNode::MResults& getResults();
00069       void evaluate( lemur::api::DOCID_T documentID, int documentLength );
00070       lemur::api::DOCID_T nextCandidateDocument();
00071       void indexChanged( indri::index::Index& index );
00072     };
00073   }
00074 }
00075 
00076 #endif // INDRI_CONTEXTCOUNTACCUMULATOR_HPP
00077 
00078 

Generated on Tue Jun 15 11:02:53 2010 for Lemur by doxygen 1.3.4