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

OrderedWindowNode.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 // OrderedWindowNode
00015 //
00016 // 26 January 2004 -- tds
00017 // 
00018 
00019 #ifndef INDRI_ORDEREDWINDOWNODE_HPP
00020 #define INDRI_ORDEREDWINDOWNODE_HPP
00021 
00022 #include "indri/ListIteratorNode.hpp"
00023 #include <vector>
00024 #include <indri/greedy_vector>
00025 #include <assert.h>
00026 
00027 //
00028 // Expression:
00029 //     #od<number>( <word>+ ) | #<number>( <word>+ )
00030 // Examples:
00031 //     #2( word1 word2 )
00032 //     #od2( word1 word2 )
00033 //
00034 // Semantics:
00035 //    Means "find these words, in order, in the text, where no two
00036 //    adjacent words in the query are further apart than <number>-1".
00037 //
00038 // Examples:
00039 //    #2(george bush) matches "george w. bush" but not "george herbert walker bush"
00040 //    #2(george w bush) matches "george this w. that bush" but not "george w. this that bush"
00041 //
00042 namespace indri
00043 {
00044   namespace infnet
00045   {
00046     
00047     class OrderedWindowNode : public ListIteratorNode {
00048     private:
00049       struct extents_pointer {
00050         indri::utility::greedy_vector<indri::index::Extent>::const_iterator iter;
00051         indri::utility::greedy_vector<indri::index::Extent>::const_iterator end;
00052       };
00053       int _windowSize;
00054       std::vector<ListIteratorNode*> _children;
00055       indri::utility::greedy_vector<indri::index::Extent> _extents;
00056       std::vector<extents_pointer> _pointers;
00057       std::string _name;
00058 
00059     public:
00060       OrderedWindowNode( const std::string& name, const std::vector<ListIteratorNode*>& children );
00061       OrderedWindowNode( const std::string& name, const std::vector<ListIteratorNode*>& children, int windowSize );
00062 
00063       lemur::api::DOCID_T nextCandidateDocument();
00064       void indexChanged( indri::index::Index& index );
00065 
00066       void prepare( lemur::api::DOCID_T documentID );
00067       const indri::utility::greedy_vector<indri::index::Extent>& extents();
00068       const std::string& getName() const ;
00069       void annotate( class Annotator& annotator, lemur::api::DOCID_T documentID, indri::index::Extent &extent );
00070     };
00071   }
00072 }
00073 
00074 #endif // INDRI_ORDEREDWINDOWNODE_HPP
00075 

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