00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef INDRI_NESTEDLISTBELIEFNODE_HPP
00020 #define INDRI_NESTEDLISTBELIEFNODE_HPP
00021
00022 #include "indri/BeliefNode.hpp"
00023 #include "indri/TermScoreFunction.hpp"
00024 #include "indri/greedy_vector"
00025 #include "indri/ListIteratorNode.hpp"
00026 #include "indri/ScoredExtentResult.hpp"
00027 namespace indri
00028 {
00029 namespace infnet
00030 {
00031
00032 class NestedListBeliefNode : public BeliefNode {
00033 private:
00034 ListIteratorNode& _list;
00035 ListIteratorNode* _context;
00036 ListIteratorNode* _raw;
00037 double _maximumScore;
00038 double _maximumBackgroundScore;
00039 indri::query::TermScoreFunction& _scoreFunction;
00040 indri::utility::greedy_vector<indri::api::ScoredExtentResult> _scores;
00041 indri::utility::greedy_vector<bool> _matches;
00042 std::string _name;
00043 bool _documentSmoothing;
00044
00045 private:
00046
00047 inline int _contextLength( int begin, int end );
00048 inline double _contextOccurrences( int begin, int end );
00049 inline double _documentOccurrences();
00050
00051 public:
00052 NestedListBeliefNode( const std::string& name,
00053 ListIteratorNode& child,
00054 ListIteratorNode* context,
00055 ListIteratorNode* raw,
00056 indri::query::TermScoreFunction& scoreFunction,
00057 double maximumBackgroundScore,
00058 double maximumScore );
00059
00060 lemur::api::DOCID_T nextCandidateDocument();
00061 void indexChanged( indri::index::Index& index );
00062 double maximumBackgroundScore();
00063 double maximumScore();
00064 const indri::utility::greedy_vector<indri::api::ScoredExtentResult>& score( lemur::api::DOCID_T documentID, indri::index::Extent &extent, int documentLength );
00065 void annotate( class Annotator& annotator, lemur::api::DOCID_T documentID, indri::index::Extent &extent );
00066 bool hasMatch( lemur::api::DOCID_T documentID );
00067 const indri::utility::greedy_vector<bool>& hasMatch( lemur::api::DOCID_T documentID, const indri::utility::greedy_vector<indri::index::Extent>& extents );
00068 const std::string& getName() const;
00069 };
00070 }
00071 }
00072
00073 #endif // INDRI_NESTEDLISTBELIEFNODE_HPP