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

sapt_pscore_coherence.h « UG « TranslationModel « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1d13f7753b5116fa6167194577d0f4c88d773b49 (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 sapt
{
  template<typename Token>
  class
  PScoreCoherence : public PhraseScorer<Token>
  {
  public:
    PScoreCoherence(std::string const dummy)
    {
      this->m_index = -1;
      this->m_num_feats = 1;
      this->m_feature_names.push_back(std::string("coherence"));
    }

    void
    operator()(Bitext<Token> const& bt,
	       PhrasePair<Token>& pp,
	       ttasksptr const& ttask,
	       std::vector<float> * dest = NULL) const
    {
      if (!dest) dest = &pp.fvals;
      (*dest)[this->m_index] = log(pp.good1) - log(pp.sample1);
    }
  };
}