|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef moses_LanguageModelSRI_h |
|
#define moses_LanguageModelSRI_h |
|
|
|
#include <string> |
|
#include <vector> |
|
#include "moses/Factor.h" |
|
#include "moses/TypeDef.h" |
|
#include "SingleFactor.h" |
|
|
|
class Factor; |
|
class Phrase; |
|
class Vocab; |
|
class Ngram; |
|
|
|
namespace Moses |
|
{ |
|
|
|
|
|
|
|
class LanguageModelSRI : public LanguageModelSingleFactor |
|
{ |
|
protected: |
|
std::vector<unsigned int> m_lmIdLookup; |
|
::Vocab *m_srilmVocab; |
|
Ngram *m_srilmModel; |
|
unsigned int m_unknownId; |
|
|
|
LMResult GetValue(unsigned int wordId, unsigned int *context) const; |
|
void CreateFactors(); |
|
unsigned int GetLmID( const std::string &str ) const; |
|
unsigned int GetLmID( const Factor *factor ) const; |
|
|
|
public: |
|
LanguageModelSRI(const std::string &line); |
|
~LanguageModelSRI(); |
|
void Load(AllOptions::ptr const& opts); |
|
|
|
virtual LMResult GetValue(const std::vector<const Word*> &contextFactor, State* finalState = 0) const; |
|
}; |
|
|
|
|
|
} |
|
#endif |
|
|