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

WeightedSumNode.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 // WeightedSumNode
00014 //
00015 // 31 March 2004 -- tds
00016 //
00017 // Implements the InQuery #wsum operator.
00018 //
00019 // Note that this class transforms the probabilities
00020 // out of log space and back into log space, which
00021 // could cause a loss of precision.
00022 //
00023 
00024 #ifndef INDRI_WEIGHTEDSUMNODE_HPP
00025 #define INDRI_WEIGHTEDSUMNODE_HPP
00026 
00027 #include "indri/BeliefNode.hpp"
00028 #include <vector>
00029 #include "indri/greedy_vector"
00030 #include "indri/ScoredExtentResult.hpp"
00031 namespace indri
00032 {
00033   namespace infnet
00034   {
00035     
00036     class WeightedSumNode : public BeliefNode {
00037     private:
00038       std::vector<BeliefNode*> _children;
00039       std::vector<double> _weights;
00040       indri::utility::greedy_vector<indri::api::ScoredExtentResult> _scores;
00041       indri::utility::greedy_vector<bool> _matches;
00042       std::string _name;
00043 
00044     public:
00045       WeightedSumNode( const std::string& name );
00046 
00047       lemur::api::DOCID_T nextCandidateDocument();
00048       void indexChanged( indri::index::Index& index );
00049       double maximumScore();
00050       double maximumBackgroundScore();
00051 
00052       const indri::utility::greedy_vector<indri::api::ScoredExtentResult>& score( lemur::api::DOCID_T documentID, indri::index::Extent &extent, int documentLength );
00053       void annotate( class Annotator& annotator, lemur::api::DOCID_T documentID, indri::index::Extent &extent );
00054       bool hasMatch( lemur::api::DOCID_T documentID );
00055       const indri::utility::greedy_vector<bool>& hasMatch( lemur::api::DOCID_T documentID, const indri::utility::greedy_vector<indri::index::Extent>& extents );
00056       void addChild( double weight, BeliefNode* child );
00057       const std::string& getName() const;
00058 
00059       virtual void setSiblingsFlag(int f);
00060 
00061     };
00062   }
00063 }
00064 
00065 
00066 #endif // INDRI_WEIGHTEDSUMNODE_HPP

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