mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-05 02:22:21 +03:00
29 lines
605 B
C
29 lines
605 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 SVertexBeam*>::const_iterator p =
|
||
|
bundle.beams.begin(); p != bundle.beams.end(); ++p) {
|
||
|
const SVertexBeam *beam = *p;
|
||
|
if (beam->front()->best) {
|
||
|
score += beam->front()->best->score;
|
||
|
}
|
||
|
}
|
||
|
return score;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
} // Syntax
|
||
|
} // Moses
|