summaryrefslogtreecommitdiff
path: root/decoder/freqdict.h
diff options
context:
space:
mode:
Diffstat (limited to 'decoder/freqdict.h')
-rw-r--r--decoder/freqdict.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/decoder/freqdict.h b/decoder/freqdict.h
new file mode 100644
index 00000000..9acf0c33
--- /dev/null
+++ b/decoder/freqdict.h
@@ -0,0 +1,20 @@
+#ifndef _FREQDICT_H_
+#define _FREQDICT_H_
+
+#include <map>
+#include <string>
+#include "wordid.h"
+
+class FreqDict {
+ public:
+ void Load(const std::string& fname);
+ float LookUp(const WordID& word) const {
+ std::map<WordID,float>::const_iterator i = counts_.find(word);
+ if (i == counts_.end()) return 0;
+ return i->second;
+ }
+ private:
+ std::map<WordID, float> counts_;
+};
+
+#endif