|
#ifndef moses_LM_Rand_h |
|
#define moses_LM_Rand_h |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <vector> |
|
#include <string> |
|
#include <stdint.h> |
|
#include "SingleFactor.h" |
|
#include "moses/TypeDef.h" |
|
#include "moses/Word.h" |
|
|
|
|
|
namespace randlm |
|
{ |
|
class RandLM; |
|
} |
|
|
|
namespace Moses |
|
{ |
|
class LanguageModelRandLM : public LanguageModelSingleFactor |
|
{ |
|
public: |
|
LanguageModelRandLM(const std::string &line); |
|
~LanguageModelRandLM(); |
|
|
|
void Load(AllOptions::ptr const& opts); |
|
virtual LMResult GetValue(const std::vector<const Word*> &contextFactor, State* finalState = NULL) const; |
|
void InitializeForInput(ttasksptr const& ttask); |
|
void CleanUpAfterSentenceProcessing(const InputType& source); |
|
|
|
protected: |
|
|
|
std::vector<uint32_t> m_randlm_ids_vec; |
|
|
|
randlm::RandLM* m_lm; |
|
uint32_t m_oov_id; |
|
void CreateFactors(FactorCollection &factorCollection); |
|
uint32_t GetLmID( const std::string &str ) const; |
|
uint32_t GetLmID( const Factor *factor ) const; |
|
|
|
}; |
|
|
|
} |
|
|
|
#endif |
|
|