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 // FilterRequireNode 00015 // 00016 // 13 April 2004 -- tds 00017 // 00018 00019 #ifndef INDRI_FILTERREQUIRENODE_HPP 00020 #define INDRI_FILTERREQUIRENODE_HPP 00021 00022 #include "indri/BeliefNode.hpp" 00023 #include "indri/ListIteratorNode.hpp" 00024 #include "indri/Extent.hpp" 00025 namespace indri 00026 { 00027 namespace infnet 00028 { 00029 00030 class FilterRequireNode : public BeliefNode { 00031 private: 00032 ListIteratorNode* _filter; 00033 BeliefNode* _required; 00034 indri::utility::greedy_vector<indri::api::ScoredExtentResult> _extents; 00035 indri::utility::greedy_vector<bool> _matches; 00036 std::string _name; 00037 00038 public: 00039 FilterRequireNode( const std::string& name, ListIteratorNode* filter, 00040 BeliefNode* required ); 00041 00042 double maximumBackgroundScore(); 00043 double maximumScore(); 00044 const indri::utility::greedy_vector<indri::api::ScoredExtentResult>& score( lemur::api::DOCID_T documentID, indri::index::Extent &extent, int documentLength ); 00045 bool hasMatch( lemur::api::DOCID_T documentID ); 00046 const indri::utility::greedy_vector<bool>& hasMatch( lemur::api::DOCID_T documentID, const indri::utility::greedy_vector<indri::index::Extent>& extents ); 00047 00048 lemur::api::DOCID_T nextCandidateDocument(); 00049 void indexChanged( indri::index::Index& index ); 00050 00051 const std::string& getName() const; 00052 void annotate( class Annotator& annotator, lemur::api::DOCID_T documentID, indri::index::Extent &extent ); 00053 00054 virtual void setSiblingsFlag(int f){ 00055 bSiblings=f; // need to set the flag for the current node itself. 00056 if (_required) { _required->setSiblingsFlag(f); } 00057 } 00058 00059 }; 00060 } 00061 } 00062 00063 #endif // INDRI_FILTERREQUIRENODE_HPP