Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SHyperedgeBundleScorer.h « Syntax « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3be6037d301969af79635412ece09967129baf81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#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