mosesdecoder/moses/SyntacticLanguageModel.h

55 lines
1.2 KiB
C
Raw Normal View History

//
#ifndef moses_SyntacticLanguageModel_h
#define moses_SyntacticLanguageModel_h
#include "FeatureFunction.h"
#include <stdexcept>
class YModel; // hidden model
class XModel; // observed model
namespace Moses
{
2013-05-29 21:16:15 +04:00
template <class MH, class MO> class SyntacticLanguageModelFiles;
2013-05-29 21:16:15 +04:00
class SyntacticLanguageModel : public StatefulFeatureFunction
{
public:
SyntacticLanguageModel(const std::string &line);
2013-05-29 21:16:15 +04:00
~SyntacticLanguageModel();
2013-05-29 21:16:15 +04:00
size_t GetNumScoreComponents() const;
2013-05-29 21:16:15 +04:00
const FFState* EmptyHypothesisState(const InputType &input) const;
2013-05-29 21:16:15 +04:00
FFState* Evaluate(const Hypothesis& cur_hypo,
const FFState* prev_state,
ScoreComponentCollection* accumulator) const;
FFState* EvaluateWhenApplied(const ChartHypothesis& cur_hypo,
2015-01-14 14:07:42 +03:00
int featureID,
ScoreComponentCollection* accumulator) const {
2013-05-29 21:16:15 +04:00
throw std::runtime_error("Syntactic LM can only be used with phrase-based decoder.");
}
2013-05-29 21:16:15 +04:00
// double perplexity();
2013-05-29 21:16:15 +04:00
private:
2013-05-29 21:16:15 +04:00
const size_t m_NumScoreComponents;
SyntacticLanguageModelFiles<YModel,XModel>* m_files;
const FactorType m_factorType;
const size_t m_beamWidth;
2013-05-29 21:16:15 +04:00
};
}
#endif