00001 /*========================================================================== 00002 * Copyright (c) 2002 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 author: fff 00014 */ 00015 #ifndef _RELDOCUNIGRAMCOUNTER_HPP 00016 #define _RELDOCUNIGRAMCOUNTER_HPP 00017 00018 #include "common_headers.hpp" 00019 #include "WeightedIDSet.hpp" 00020 #include "Counter.hpp" 00021 #include "Index.hpp" 00022 #include <cmath> 00023 namespace lemur 00024 { 00025 namespace langmod 00026 { 00027 00030 00031 class RelDocUnigramCounter : public lemur::utility::ArrayCounter <double> { 00032 public: 00034 RelDocUnigramCounter(lemur::api::DOCID_T docID, const lemur::api::Index &homeIndex); 00035 00037 RelDocUnigramCounter(const lemur::utility::WeightedIDSet &docSet, const lemur::api::Index &homeIndex); 00038 00039 virtual ~RelDocUnigramCounter() {} 00040 const string lexiconID() const { return (ind.termLexiconID());} 00041 00042 protected: 00045 void countRelDocUnigram(lemur::api::DOCID_T docID, double weight=1); 00046 00047 const lemur::api::Index &ind; 00048 }; 00049 00050 } 00051 } 00052 00053 #endif /* _RELDOCUNIGRAMCOUNTER_HPP */