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 // Annotator 00015 // 00016 // 19 July 2004 -- tds 00017 // 00018 00019 #ifndef INDRI_ANNOTATOR_HPP 00020 #define INDRI_ANNOTATOR_HPP 00021 00022 #include <map> 00023 #include <vector> 00024 #include <algorithm> 00025 #include <set> 00026 00027 #include "indri/InferenceNetworkNode.hpp" 00028 #include "indri/BeliefNode.hpp" 00029 #include "indri/EvaluatorNode.hpp" 00030 #include "indri/Extent.hpp" 00031 namespace indri 00032 { 00034 namespace infnet 00035 { 00036 00037 class Annotator : public EvaluatorNode { 00038 private: 00039 BeliefNode* _belief; 00040 EvaluatorNode::MResults _annotations; 00041 std::string _name; 00042 00043 std::map<std::string, std::set<indri::api::ScoredExtentResult, indri::api::ScoredExtentResult::score_greater> > _seen; 00044 00045 public: 00046 Annotator( const std::string& name, BeliefNode* belief ); 00047 void add( InferenceNetworkNode* node, lemur::api::DOCID_T documentID, indri::index::Extent &extent ); 00048 void addMatches( indri::utility::greedy_vector<indri::index::Extent>& extents, InferenceNetworkNode* node, lemur::api::DOCID_T documentID, indri::index::Extent &extent ); 00049 void evaluate( lemur::api::DOCID_T documentID, int documentLength ); 00050 00051 lemur::api::DOCID_T nextCandidateDocument(); 00052 void indexChanged( indri::index::Index& index ); 00053 00054 EvaluatorNode::MResults& getResults(); 00055 const std::string& getName() const; 00056 const EvaluatorNode::MResults& getResults() const; 00057 }; 00058 } 00059 } 00060 00061 #endif // INDRI_ANNOTATOR_HPP