summaryrefslogtreecommitdiff
path: root/klm/search/context.hh
blob: c3c8e53bf20aecb28a6c0e466b45e8a6df74f5dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef SEARCH_CONTEXT__
#define SEARCH_CONTEXT__

#include "search/config.hh"
#include "search/vertex.hh"

#include <boost/pool/object_pool.hpp>

namespace search {

class ContextBase {
  public:
    explicit ContextBase(const Config &config) : config_(config) {}

    unsigned int PopLimit() const { return config_.PopLimit(); }

    Score LMWeight() const { return config_.LMWeight(); }

    const Config &GetConfig() const { return config_; }

  private:
    Config config_;
};

template <class Model> class Context : public ContextBase {
  public:
    Context(const Config &config, const Model &model) : ContextBase(config), model_(model) {}

    const Model &LanguageModel() const { return model_; }

  private:
    const Model &model_;
};

} // namespace search

#endif // SEARCH_CONTEXT__