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

LengthPriorNode.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2006 Carnegie Mellon University.  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 below), and also available at
00007  * http://www.lemurproject.org/license.html
00008  *
00009  *==========================================================================
00010  */
00011 
00012 
00013 //
00014 // LengthPriorNode
00015 // 
00016 // 9 July 2005 -- pto
00017 //
00018 
00019 // Implements an extent length based prior of the form  P(extent) proportional to (end - begin) ^ exponent.
00020 // In terms of actual ranking, exponent * log ( end - begin ) is computed, where INDRI_TINY_SCORE is 
00021 // used for extents of length 0.
00022 
00023 #ifndef INDRI_LENGTHPRIORNODE_HPP
00024 #define INDRI_LENGTHPRIORNODE_HPP
00025 
00026 #include "indri/BeliefNode.hpp"
00027 
00028 namespace indri
00029 {
00030   namespace infnet
00031   {
00032     
00033     class LengthPriorNode : public BeliefNode {
00034     private:
00035       indri::utility::greedy_vector<indri::api::ScoredExtentResult> _scores;
00036       BeliefNode * _child;
00037       std::string _name;
00038       double _exponent;
00039 
00040     public:
00041       LengthPriorNode( const std::string& name, BeliefNode * child, double exponent );
00042       ~LengthPriorNode();
00043 
00044       lemur::api::DOCID_T nextCandidateDocument();
00045       void indexChanged( indri::index::Index& index );
00046 
00047       bool hasMatch( lemur::api::DOCID_T documentID );
00048       const indri::utility::greedy_vector<bool>& hasMatch( lemur::api::DOCID_T documentID, const indri::utility::greedy_vector<indri::index::Extent>& extents );
00049       const indri::utility::greedy_vector<indri::api::ScoredExtentResult>& score( lemur::api::DOCID_T documentID, indri::index::Extent &extent, int documentLength );
00050       void annotate( class Annotator& annotator, lemur::api::DOCID_T documentID, indri::index::Extent &extent );
00051       double maximumScore();
00052       double maximumBackgroundScore();
00053       const std::string& getName() const;
00054 
00055       virtual void setSiblingsFlag(int f){
00056         bSiblings=f; // need to set the flag for the current node itself.
00057         if (_child) {  _child->setSiblingsFlag(f); }
00058       }
00059 
00060     };
00061   }
00062 }
00063 
00064 #endif // INDRI_LENGTHPRIORNODE_HPP
00065 

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