2014-11-04 16:13:56 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "SHyperedgeBundle.h"
|
|
|
|
|
|
|
|
namespace Moses
|
|
|
|
{
|
|
|
|
namespace Syntax
|
|
|
|
{
|
|
|
|
|
2015-01-14 14:07:42 +03:00
|
|
|
struct SHyperedgeBundleScorer {
|
|
|
|
public:
|
2014-11-04 16:13:56 +03:00
|
|
|
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) {
|
2015-11-16 22:23:27 +03:00
|
|
|
score += stack->front()->best->label.futureScore;
|
2014-11-04 16:13:56 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return score;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // Syntax
|
|
|
|
} // Moses
|