mosesdecoder/moses/Syntax/SHyperedgeBundleScorer.h

28 lines
624 B
C
Raw Normal View History

#pragma once
#include "SHyperedgeBundle.h"
namespace Moses
{
namespace Syntax
{
2015-01-14 14:07:42 +03:00
struct SHyperedgeBundleScorer {
public:
static float Score(const SHyperedgeBundle &bundle) {
const TargetPhrase &targetPhrase = **(bundle.translations->begin());
float score = targetPhrase.GetFutureScore();
2014-11-10 19:54:14 +03:00
for (std::vector<const SVertexStack*>::const_iterator p =
2015-01-14 14:07:42 +03:00
bundle.stacks.begin(); p != bundle.stacks.end(); ++p) {
2014-11-10 19:54:14 +03:00
const SVertexStack *stack = *p;
if (stack->front()->best) {
score += stack->front()->best->label.futureScore;
}
}
return score;
}
};
} // Syntax
} // Moses