00001 #ifndef moses_LanguageModelInternal_h 00002 #define moses_LanguageModelInternal_h 00003 00004 #include "LanguageModelSingleFactor.h" 00005 #include "NGramCollection.h" 00006 00007 namespace Moses 00008 { 00009 00012 class LanguageModelInternal : public LanguageModelPointerState 00013 { 00014 protected: 00015 std::vector<const NGramNode*> m_lmIdLookup; 00016 NGramCollection m_map; 00017 00018 const NGramNode* GetLmID( const Factor *factor ) const { 00019 size_t factorId = factor->GetId(); 00020 return ( factorId >= m_lmIdLookup.size()) ? NULL : m_lmIdLookup[factorId]; 00021 }; 00022 00023 LMResult GetValue(const Factor *factor0, State* finalState) const; 00024 LMResult GetValue(const Factor *factor0, const Factor *factor1, State* finalState) const; 00025 LMResult GetValue(const Factor *factor0, const Factor *factor1, const Factor *factor2, State* finalState) const; 00026 00027 public: 00028 bool Load(const std::string &filePath 00029 , FactorType factorType 00030 , size_t nGramOrder); 00031 LMResult GetValue(const std::vector<const Word*> &contextFactor 00032 , State* finalState = 0) const; 00033 }; 00034 00035 } 00036 00037 #endif
1.5.9