#ifndef _FREQDICT_H_ #define _FREQDICT_H_ #include #include class FreqDict { public: void load(const std::string& fname); float frequency(const std::string& word) const { std::map::const_iterator i = counts_.find(word); if (i == counts_.end()) return 0; return i->second; } private: std::map counts_; }; #endif