From 671c21451542e2dd20e45b4033d44d8e8735f87b Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Thu, 3 Dec 2009 16:33:55 -0500 Subject: initial check in --- src/freqdict.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/freqdict.h (limited to 'src/freqdict.h') diff --git a/src/freqdict.h b/src/freqdict.h new file mode 100644 index 00000000..c9bb4c42 --- /dev/null +++ b/src/freqdict.h @@ -0,0 +1,19 @@ +#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 -- cgit v1.2.3