| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef moses_LanguageModelSingleFactor_h |
| | #define moses_LanguageModelSingleFactor_h |
| |
|
| | #include "Implementation.h" |
| | #include "moses/Phrase.h" |
| |
|
| | namespace Moses |
| | { |
| |
|
| | class FactorCollection; |
| | class Factor; |
| |
|
| | |
| | class LanguageModelSingleFactor : public LanguageModelImplementation |
| | { |
| | protected: |
| | typedef const void *State; |
| |
|
| | const Factor *m_sentenceStart, *m_sentenceEnd; |
| |
|
| | FactorType m_factorType; |
| | FFState *m_nullContextState; |
| | FFState *m_beginSentenceState; |
| |
|
| | LanguageModelSingleFactor(const std::string &line); |
| |
|
| | public: |
| | virtual ~LanguageModelSingleFactor(); |
| | bool IsUseable(const FactorMask &mask) const; |
| | virtual void SetParameter(const std::string& key, const std::string& value); |
| |
|
| | const Factor *GetSentenceStart() const { |
| | return m_sentenceStart; |
| | } |
| | const Factor *GetSentenceEnd() const { |
| | return m_sentenceEnd; |
| | } |
| | FactorType GetFactorType() const { |
| | return m_factorType; |
| | } |
| |
|
| | virtual const FFState *GetNullContextState() const; |
| | virtual const FFState *GetBeginSentenceState() const; |
| | virtual FFState *NewState(const FFState *from = NULL) const; |
| |
|
| | virtual LMResult GetValueForgotState(const std::vector<const Word*> &contextFactor, FFState &outState) const; |
| |
|
| | protected: |
| | virtual LMResult GetValue(const std::vector<const Word*> &contextFactor, State* finalState = NULL) const = 0; |
| | public: |
| | std::string DebugContextFactor(const std::vector<const Word*> &contextFactor) const; |
| | }; |
| |
|
| |
|
| |
|
| | } |
| |
|
| | #endif |
| |
|