mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-25 04:43:03 +03:00
34 lines
848 B
C++
34 lines
848 B
C++
#include "ChartTranslationOptions.h"
|
|
#include "InputType.h"
|
|
#include "InputPath.h"
|
|
|
|
namespace Moses
|
|
{
|
|
ChartTranslationOption::ChartTranslationOption(const TargetPhrase &targetPhrase)
|
|
:m_targetPhrase(targetPhrase)
|
|
,m_scoreBreakdown(targetPhrase.GetScoreBreakdown())
|
|
{
|
|
}
|
|
|
|
void ChartTranslationOption::Evaluate(const InputType &input,
|
|
const InputPath &inputPath,
|
|
const StackVec &stackVec)
|
|
{
|
|
const std::vector<FeatureFunction*> &ffs = FeatureFunction::GetFeatureFunctions();
|
|
|
|
for (size_t i = 0; i < ffs.size(); ++i) {
|
|
const FeatureFunction &ff = *ffs[i];
|
|
ff.EvaluateWithSourceContext(input, inputPath, m_targetPhrase, &stackVec, m_scoreBreakdown);
|
|
}
|
|
}
|
|
|
|
|
|
std::ostream& operator<<(std::ostream &out, const ChartTranslationOption &transOpt)
|
|
{
|
|
out << transOpt.m_targetPhrase << " " << transOpt.m_scoreBreakdown;
|
|
return out;
|
|
}
|
|
|
|
}
|
|
|