mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-11-10 10:59:21 +03:00
eb5336ad9c
doesn't work with default nplm, but with the fork at https://github.com/rsennrich/nplm
39 lines
637 B
C++
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
|
|
|
|
|
|
|
|
|
|
|