00001 #pragma once 00002 00003 #include "SingleFactor.h" 00004 00005 #include <boost/thread/tss.hpp> 00006 00007 namespace nplm 00008 { 00009 class neuralLM; 00010 } 00011 00012 namespace Moses 00013 { 00014 00015 class NeuralLMWrapper : public LanguageModelSingleFactor 00016 { 00017 protected: 00018 // big data (vocab, weights, cache) shared among threads 00019 nplm::neuralLM *m_neuralLM_shared; 00020 // thread-specific nplm for thread-safety 00021 mutable boost::thread_specific_ptr<nplm::neuralLM> m_neuralLM; 00022 int m_unk; 00023 00024 public: 00025 NeuralLMWrapper(const std::string &line); 00026 ~NeuralLMWrapper(); 00027 00028 virtual LMResult GetValue(const std::vector<const Word*> &contextFactor, State* finalState = 0) const; 00029 00030 virtual void Load(AllOptions::ptr const& opts); 00031 00032 }; 00033 00034 00035 } // namespace 00036 00037 00038 00039 00040