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

sapt_pscore_wordcount.h « UG « TranslationModel « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6cd9e7c0c880e98f5b895705a66df1c6d69a582e (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"
#include "sapt_pscore_base.h"

namespace sapt
{
  template<typename Token>
  class
  PScoreWC : public PhraseScorer<Token>
  {
  public:
    PScoreWC(std::string const dummy)
    {
      this->m_index = -1;
      this->m_num_feats = 1;
      this->m_feature_names.push_back(std::string("wordcount"));
    }

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