mosesdecoder/moses/LM/NeuralLMWrapper.h

41 lines
675 B
C
Raw Permalink Normal View History

2013-10-29 02:11:37 +04:00
#pragma once
#include "SingleFactor.h"
#include <boost/thread/tss.hpp>
2015-01-14 14:07:42 +03:00
namespace nplm
{
class neuralLM;
2013-10-29 02:11:37 +04:00
}
namespace Moses
{
2013-10-29 03:21:02 +04:00
class NeuralLMWrapper : public LanguageModelSingleFactor
2013-10-29 02:11:37 +04:00
{
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;
2013-10-29 02:11:37 +04:00
public:
2013-10-29 03:21:02 +04:00
NeuralLMWrapper(const std::string &line);
~NeuralLMWrapper();
2013-10-29 02:11:37 +04:00
virtual LMResult GetValue(const std::vector<const Word*> &contextFactor, State* finalState = 0) const;
2015-12-10 06:17:36 +03:00
virtual void Load(AllOptions::ptr const& opts);
2013-10-29 02:11:37 +04:00
};
} // namespace