00001 /*========================================================================== 00002 * Copyright (c) 2001 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 also available at 00007 * http://www.lemurproject.org/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 00013 #ifndef _DOCUNIGRAMCOUNTER_HPP 00014 #define _DOCUNIGRAMCOUNTER_HPP 00015 00016 #include "common_headers.hpp" 00017 #include "WeightedIDSet.hpp" 00018 #include "Counter.hpp" 00019 #include "Index.hpp" 00020 namespace lemur 00021 { 00023 namespace langmod 00024 { 00025 00027 00028 class DocUnigramCounter : public lemur::utility::ArrayCounter <int> { 00029 public: 00031 DocUnigramCounter(lemur::api::DOCID_T docID, const lemur::api::Index &homeIndex); 00032 00034 DocUnigramCounter(const vector<lemur::api::DOCID_T> &docSet, const lemur::api::Index &homeIndex); 00035 00037 DocUnigramCounter(const lemur::utility::WeightedIDSet &docSet, const lemur::api::Index &homeIndex); 00038 00040 DocUnigramCounter(const lemur::api::Index &collectionIndex); 00041 00042 virtual ~DocUnigramCounter() {} 00043 const string lexiconID() const { return (ind.termLexiconID());} 00044 00045 protected: 00046 00047 void countDocUnigram(lemur::api::DOCID_T docID, double weight=1); 00048 00049 const lemur::api::Index &ind; 00050 }; 00051 00052 } 00053 } 00054 00055 #endif /* _DOCUNIGRAMCOUNTER_HPP */