blob: a3211df5425b4948735c28f33212b2645591fa19 (
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
28
29
30
31
32
33
|
// -*- c++ -*-
// written by Ulrich Germann
#pragma once
#include "moses/TranslationModel/UG/mm/ug_bitext.h"
#include "util/exception.hh"
#include "boost/format.hpp"
namespace Moses {
namespace bitext
{
template<typename Token>
class
PScoreCoherence : public PhraseScorer<Token>
{
public:
PScoreCoherence(string const dummy)
{
this->m_index = -1;
this->m_num_feats = 1;
this->m_feature_names.push_back(string("coherence"));
}
void
operator()(Bitext<Token> const& bt,
PhrasePair<Token>& pp,
vector<float> * dest = NULL) const
{
if (!dest) dest = &pp.fvals;
(*dest)[this->m_index] = log(pp.good1) - log(pp.sample1);
}
};
}
}
|