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

InferenceNetwork.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 // InferenceNetwork
00014 //
00015 // 24 February 2004 -- tds
00016 //
00017 
00018 #ifndef INDRI_INFERENCENETWORK_HPP
00019 #define INDRI_INFERENCENETWORK_HPP
00020 
00021 #include "indri/BeliefNode.hpp"
00022 #include "indri/EvaluatorNode.hpp"
00023 #include "indri/ListIteratorNode.hpp"
00024 #include "indri/TermScoreFunction.hpp"
00025 #include "indri/Repository.hpp"
00026 #include "indri/Index.hpp"
00027 #include "indri/DeletedDocumentList.hpp"
00028 #include "indri/PriorListIterator.hpp"
00029 #include "indri/DocumentStructureHolderNode.hpp"
00030 
00031 namespace indri
00032 {
00033   namespace infnet 
00034   {
00035     class InferenceNetwork {
00036     public:
00037       typedef std::map< std::string, EvaluatorNode::MResults > MAllResults;
00038 
00039       //
00040       // MAllResults stores results indexed first by node name, then second by the node's 
00041       // result name.  For instance, to retrieve occurrence counts from a 
00042       // ContextCountAccumulator named "bd45a", you'd type 'results["bd45a"]["occurrences"]'.
00043       //
00044 
00045     private:
00046       std::vector<std::string> _termNames;
00047       std::vector<std::string> _fieldNames;
00048       std::vector<std::string> _priorNames;
00049 
00050       std::vector<class indri::index::DocExtentListIterator*> _fieldIterators;
00051       std::vector<class indri::index::DocListIterator*> _docIterators;
00052       std::vector<class indri::collection::PriorListIterator*> _priorIterators;
00053       std::vector<ListIteratorNode*> _listIteratorNodes;
00054       std::vector<BeliefNode*> _beliefNodes;
00055       std::vector<EvaluatorNode*> _evaluators;
00056       std::vector<EvaluatorNode*> _complexEvaluators;
00057       std::vector<indri::query::TermScoreFunction*> _scoreFunctions;
00058 
00059       DocumentStructureHolderNode * _documentStructureHolderNode;
00060 
00061       indri::utility::greedy_vector<class indri::index::DocListIterator*> _closeIterators;
00062       int _closeIteratorBound;
00063 
00064       indri::collection::Repository& _repository;
00065       MAllResults _results;
00066 
00067       void _indexChanged( indri::index::Index& index );
00068       void _indexFinished( indri::index::Index& index );
00069 
00070       void _moveToDocument( lemur::api::DOCID_T candidate );
00071       void _moveDocListIterators( lemur::api::DOCID_T candidate );
00072 
00073       lemur::api::DOCID_T _nextCandidateDocument( indri::index::DeletedDocumentList::read_transaction* deleted );
00074       void _evaluateDocument( indri::index::Index& index, lemur::api::DOCID_T document );
00075       void _evaluateIndex( indri::index::Index& index );
00076 
00077     public:
00078       InferenceNetwork( indri::collection::Repository& repository );
00079       ~InferenceNetwork();
00080 
00081       const std::vector<EvaluatorNode*>& getEvaluators() const;
00082 
00083       indri::index::DocListIterator* getDocIterator( int index );
00084       indri::index::DocExtentListIterator* getFieldIterator( int index );
00085       indri::collection::PriorListIterator* getPriorIterator( int index );
00086 
00087       int addDocIterator( const std::string& term );
00088       int addFieldIterator( const std::string& field );
00089       int addPriorIterator( const std::string& prior );
00090       
00091       void addListNode( ListIteratorNode* listNode );
00092       void addBeliefNode( BeliefNode* beliefNode );
00093       void addEvaluatorNode( EvaluatorNode* evaluatorNode );
00094       void addComplexEvaluatorNode( EvaluatorNode* complexEvaluator );
00095       void addScoreFunction( indri::query::TermScoreFunction* scoreFunction );
00096       void addDocumentStructureHolderNode( DocumentStructureHolderNode* docStruct );
00097       const MAllResults& evaluate();
00098     };
00099   }
00100 }
00101 
00102 #endif // INDRI_INFERENCENETWORK_HPP
00103 

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