mosesdecoder/moses/LM/NeuralLMWrapper.h
Rico Sennrich eb5336ad9c thread-safety, precomputation and caching for NeuralLMWrapper
doesn't work with default nplm, but with the fork at https://github.com/rsennrich/nplm
2014-07-17 16:50:08 +01:00

39 lines
637 B
C++

#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;
public:
NeuralLMWrapper(const std::string &line);
~NeuralLMWrapper();
virtual LMResult GetValue(const std::vector<const Word*> &contextFactor, State* finalState = 0) const;
virtual void Load();
};
} // namespace