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

InferenceNetworkBuilder.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 // InferenceNetworkBuilder
00015 //
00016 // 8 March 2004 -- tds
00017 //
00018 
00019 #ifndef INDRI_INFERENCENETWORKBUILDER_HPP
00020 #define INDRI_INFERENCENETWORKBUILDER_HPP
00021 
00022 #include "indri/QuerySpec.hpp"
00023 #include "indri/Repository.hpp"
00024 #include "indri/InferenceNetwork.hpp"
00025 #include "indri/ListCache.hpp"
00026 #include <map>
00027 #include <vector>
00028 
00029 class InferenceNetworkBuilder : public indri::lang::Walker {
00030 private:
00031   std::map< indri::lang::Node*, InferenceNetworkNode* > _nodeMap;
00032   InferenceNetwork* _network;
00033   Repository& _repository;
00034   ListCache& _cache;
00035   int _resultsRequested;
00036   
00037   template<typename _To, typename _From>
00038   std::vector<_To*> _translate( const std::vector<_From*>& children ) {
00039     std::vector<_To*> translation;
00040 
00041     for( unsigned int i=0; i<children.size(); i++ ) {
00042       translation.push_back( dynamic_cast<_To*>(_nodeMap[children[i]]) );  
00043     }
00044 
00045     return translation;
00046   }
00047 
00048   TermScoreFunction* _buildTermScoreFunction( const std::string& smoothing, UINT64 occurrences, UINT64 contextSize ) const;
00049 
00050 public:
00051   InferenceNetworkBuilder( Repository& repository, ListCache& cache, int resultsRequested );
00052   ~InferenceNetworkBuilder();
00053 
00054   InferenceNetwork* getNetwork();
00055 
00056   void defaultAfter( indri::lang::Node* node );
00057   void after( indri::lang::IndexTerm* term );
00058   void after( indri::lang::Field* field );
00059   void after( indri::lang::ExtentAnd* extentAnd );
00060   void after( indri::lang::ExtentOr* extentOr );
00061   void after( indri::lang::ExtentInside* extentInside );
00062   void after( indri::lang::ODNode* odNode );
00063   void after( indri::lang::UWNode* uwNode );
00064   void after( indri::lang::FilRejNode* uwNode );
00065   void after( indri::lang::FilReqNode* uwNode );
00066   void after( indri::lang::ContextCounterNode* contextCounterNode );
00067   void after( indri::lang::ScoreAccumulatorNode* scoreAccumulatorNode );
00068   void after( indri::lang::AnnotatorNode* annotatorNode );
00069   void after( indri::lang::TermFrequencyScorerNode* termScorerNode );
00070   void after( indri::lang::CachedFrequencyScorerNode* cachedScorerNode );
00071   void after( indri::lang::RawScorerNode* rawScorerNode );
00072   void after( indri::lang::ExtentRestriction* erNode );
00073   void after( indri::lang::PriorNode* priorNode );
00074   void after( indri::lang::WeightNode* weightNode );
00075   void after( indri::lang::CombineNode* combineNode );
00076   void after( indri::lang::OrNode* orNode );
00077   void after( indri::lang::NotNode* notSpecNode );
00078   void after( indri::lang::MaxNode* maxNode );
00079   void after( indri::lang::WAndNode* wandNode );
00080   void after( indri::lang::WSumNode* wsumNode );
00081   void after( indri::lang::FieldLessNode* flNode );
00082   void after( indri::lang::FieldGreaterNode* fgNode );
00083   void after( indri::lang::FieldBetweenNode* fbNode );
00084   void after( indri::lang::FieldEqualsNode* fbNode );
00085   void after( indri::lang::FilterNode* filterNode );
00086 };
00087 
00088 #endif // INDRI_INFERENCENETWORKBUILDER
00089 
00090 

Generated on Wed Nov 3 12:58:58 2004 for Lemur Toolkit by doxygen1.2.18