summaryrefslogtreecommitdiff
path: root/decoder/freqdict.h
blob: 9acf0c331ea89fc1024516fae81e9c10ce1750df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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