00001 /*========================================================================== 00002 * Copyright (c) 2006 Carnegie Mellon University. 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 below), and also available at 00007 * http://www.lemurproject.org/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 00013 // 00014 // ExtentEnforcementNode 00015 // 00016 // 31 Aug 2005 -- pto 00017 // 00018 00019 // Behaves like extent restriction, but preserves the child's extents 00020 // rather than using the field extents. It merely enforces that 00021 // the child extents be contained within the field extents. 00022 00023 #ifndef INDRI_EXTENTENFORCEMENTNODE_HPP 00024 #define INDRI_EXTENTENFORCEMENTNODE_HPP 00025 00026 #include "indri/ExtentRestrictionNode.hpp" 00027 00028 namespace indri 00029 { 00030 namespace infnet 00031 { 00032 00033 class ExtentEnforcementNode : public BeliefNode { 00034 private: 00035 BeliefNode* _child; 00036 ListIteratorNode* _field; 00037 indri::utility::greedy_vector<indri::api::ScoredExtentResult> _scores; 00038 indri::utility::greedy_vector<bool> _matches; 00039 std::string _name; 00040 00041 public: 00042 ExtentEnforcementNode( const std::string& name, BeliefNode* child, ListIteratorNode* field ); 00043 00044 lemur::api::DOCID_T nextCandidateDocument(); 00045 void indexChanged( indri::index::Index& index ); 00046 00047 double maximumScore(); 00048 double maximumBackgroundScore(); 00049 00050 const indri::utility::greedy_vector<indri::api::ScoredExtentResult>& score( lemur::api::DOCID_T documentID, indri::index::Extent &extent, int documentLength ); 00051 void annotate( class Annotator& annotator, lemur::api::DOCID_T documentID, indri::index::Extent &extent ); 00052 bool hasMatch( lemur::api::DOCID_T documentID ); 00053 const indri::utility::greedy_vector<bool>& hasMatch( lemur::api::DOCID_T documentID, const indri::utility::greedy_vector<indri::index::Extent>& extents ); 00054 const std::string& getName() const; 00055 00058 void setSiblingsFlag(int f); 00059 }; 00060 } 00061 } 00062 00063 #endif // INDRI_EXTENTENFORCEMENTNODE_HPP