File size: 675 Bytes
158b61b |
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 41 |
#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
|