00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef INDRI_FILTERNODE_HPP
00023 #define INDRI_FILTERNODE_HPP
00024
00025 class FilterNode : public BeliefNode {
00026 private:
00027 BeliefNode* _belief;
00028 std::vector<int> _documents;
00029 std::string _name;
00030 int _index;
00031
00032 public:
00033 FilterNode( const std::string& name, BeliefNode* child, const std::vector<int>& documents )
00034 :
00035 _documents(documents)
00036 {
00037 _name = name;
00038 _belief = child;
00039 _index = 0;
00040 std::sort( _documents.begin(), _documents.end() );
00041 }
00042
00043 int nextCandidateDocument() {
00044 int childNext = _belief->nextCandidateDocument();
00045
00046 while( _index < _documents.size() && _documents[_index] < childNext )
00047 _index++;
00048
00049 if( _index == _documents.size() )
00050 return MAX_INT32;
00051
00052 return _documents[_index];
00053 }
00054
00055 void annotate( Annotator& annotator, int documentID, int begin, int end ) {
00056 return _belief->annotate( annotator, documentID, begin, end );
00057 }
00058
00059 const greedy_vector<ScoredExtentResult>& score( int documentID, int begin, int end, int documentLength ) {
00060 return _belief->score( documentID, begin, end, documentLength );
00061 }
00062
00063 double maximumScore() {
00064 return _belief->maximumScore();
00065 }
00066
00067 double maximumBackgroundScore() {
00068 return _belief->maximumBackgroundScore();
00069 }
00070
00071 bool hasMatch( int documentID ) {
00072 return _belief->hasMatch( documentID );
00073 }
00074
00075 const std::string& getName() const {
00076 return _name;
00077 }
00078 };
00079
00080 #endif // INDRI_FILTERNODE_HPP
00081