Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound 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 
00043 class OrderedWindowNode : public ListIteratorNode {
00044 private:
00045   struct extents_pointer {
00046     greedy_vector<Extent>::const_iterator iter;
00047     greedy_vector<Extent>::const_iterator end;
00048   };
00049   int _windowSize;
00050   std::vector<ListIteratorNode*> _children;
00051   greedy_vector<Extent> _extents;
00052   std::vector<extents_pointer> _pointers;
00053   std::string _name;
00054 
00055 public:
00056   OrderedWindowNode( const std::string& name, const std::vector<ListIteratorNode*>& children );
00057   OrderedWindowNode( const std::string& name, const std::vector<ListIteratorNode*>& children, int windowSize );
00058   int nextCandidateDocument();
00059   void prepare( int documentID );
00060   const greedy_vector<Extent>& extents();
00061   const std::string& getName() const ;
00062   void annotate( class Annotator& annotator, int documentID, int begin, int end );
00063 };
00064 
00065 #endif // INDRI_ORDEREDWINDOWNODE_HPP
00066 

Generated on Wed Nov 3 12:59:01 2004 for Lemur Toolkit by doxygen1.2.18