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 // FixedPassageNode 00013 // 00014 // 23 February 2005 -- tds 00015 // 00016 00017 #ifndef INDRI_FIXEDPASSAGENODE_HPP 00018 #define INDRI_FIXEDPASSAGENODE_HPP 00019 00020 #include "indri/BeliefNode.hpp" 00021 #include "indri/FieldIteratorNode.hpp" 00022 #include "indri/greedy_vector" 00023 #include "indri/Extent.hpp" 00024 namespace indri 00025 { 00026 namespace infnet 00027 { 00028 00029 class FixedPassageNode : public BeliefNode { 00030 private: 00031 BeliefNode* _child; 00032 indri::utility::greedy_vector<indri::api::ScoredExtentResult> _scores; 00033 indri::utility::greedy_vector<bool> _matches; 00034 indri::utility::greedy_vector<indri::index::Extent> _subextents; 00035 00036 std::string _name; 00037 00038 int _windowSize; 00039 int _increment; 00040 void _addSubextents( const indri::index::Extent& extent ); 00041 void _buildSubextents( const indri::index::Extent& extent ); 00042 void _buildSubextents( const indri::utility::greedy_vector<indri::index::Extent>& extents ); 00043 00044 public: 00045 FixedPassageNode( const std::string& name, BeliefNode* child, int windowSize, int increment ); 00046 00047 lemur::api::DOCID_T nextCandidateDocument(); 00048 void indexChanged( indri::index::Index& index ); 00049 00050 double maximumScore(); 00051 double maximumBackgroundScore(); 00052 00053 const indri::utility::greedy_vector<indri::api::ScoredExtentResult>& score( lemur::api::DOCID_T documentID, indri::index::Extent &extent, int documentLength ); 00054 void annotate( class Annotator& annotator, lemur::api::DOCID_T documentID, indri::index::Extent &extent ); 00055 00056 const indri::utility::greedy_vector<bool>& hasMatch( lemur::api::DOCID_T documentID, const indri::utility::greedy_vector<indri::index::Extent>& extents ); 00057 bool hasMatch( lemur::api::DOCID_T documentID ); 00058 const std::string& getName() const; 00059 00060 virtual void setSiblingsFlag(int f){ 00061 bSiblings=f; // need to set the flag for the current node itself. 00062 if (_child) { _child->setSiblingsFlag(f); } 00063 } 00064 00065 }; 00066 } 00067 } 00068 00069 00070 #endif // INDRI_FIXEDPASSAGENODE_HPP 00071 00072