Welcome to mirror list, hosted at ThFree Co, Russian Federation.

NeuralLMWrapper.h « LM « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 66a0278a931ae1972538a0d35d4f458a01ce76f7 (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
38
39
40
#pragma once

#include "SingleFactor.h"

#include <boost/thread/tss.hpp>

namespace nplm
{
class neuralLM;
}

namespace Moses
{

class NeuralLMWrapper : public LanguageModelSingleFactor
{
protected:
  // big data (vocab, weights, cache) shared among threads
  nplm::neuralLM *m_neuralLM_shared;
  // thread-specific nplm for thread-safety
  mutable boost::thread_specific_ptr<nplm::neuralLM> m_neuralLM;
  int m_unk;

public:
  NeuralLMWrapper(const std::string &line);
  ~NeuralLMWrapper();

  virtual LMResult GetValue(const std::vector<const Word*> &contextFactor, State* finalState = 0) const;

  virtual void Load(AllOptions::ptr const& opts);

};


} // namespace