summaryrefslogtreecommitdiff
path: root/decoder/freqdict.h
diff options
context:
space:
mode:
authorredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-06-22 05:12:27 +0000
committerredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-06-22 05:12:27 +0000
commit0172721855098ca02b207231a654dffa5e4eb1c9 (patch)
tree8069c3a62e2d72bd64a2cdeee9724b2679c8a56b /decoder/freqdict.h
parent37728b8be4d0b3df9da81fdda2198ff55b4b2d91 (diff)
initial checkin
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@2 ec762483-ff6d-05da-a07a-a48fb63a330f
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