mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-30 15:34:01 +03:00
d317fdc373
This mirrors the change made for the chart decoder in commit 465b4756...
28 lines
624 B
C++
28 lines
624 B
C++
#pragma once
|
|
|
|
#include "SHyperedgeBundle.h"
|
|
|
|
namespace Moses
|
|
{
|
|
namespace Syntax
|
|
{
|
|
|
|
struct SHyperedgeBundleScorer {
|
|
public:
|
|
static float Score(const SHyperedgeBundle &bundle) {
|
|
const TargetPhrase &targetPhrase = **(bundle.translations->begin());
|
|
float score = targetPhrase.GetFutureScore();
|
|
for (std::vector<const SVertexStack*>::const_iterator p =
|
|
bundle.stacks.begin(); p != bundle.stacks.end(); ++p) {
|
|
const SVertexStack *stack = *p;
|
|
if (stack->front()->best) {
|
|
score += stack->front()->best->label.futureScore;
|
|
}
|
|
}
|
|
return score;
|
|
}
|
|
};
|
|
|
|
} // Syntax
|
|
} // Moses
|