diff options
author | Ulrich Germann <ugermann@inf.ed.ac.uk> | 2014-07-09 05:41:28 +0400 |
---|---|---|
committer | Ulrich Germann <ugermann@inf.ed.ac.uk> | 2014-07-09 05:41:28 +0400 |
commit | 4d41211c2cd6eb75c5a229c10e98fdfa1acff3b4 (patch) | |
tree | 142dca24625b301147a931f728825dd40cf74e53 /moses/TranslationModel/UG/sapt_pscore_coherence.h | |
parent | 28d64e23396cba53a83b75e01e9977db636e2285 (diff) |
Major overhaul of Mmsapt. Reorganization of old and addition of new features in phrase tables. Many critical bug fixes.
Diffstat (limited to 'moses/TranslationModel/UG/sapt_pscore_coherence.h')
-rw-r--r-- | moses/TranslationModel/UG/sapt_pscore_coherence.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/moses/TranslationModel/UG/sapt_pscore_coherence.h b/moses/TranslationModel/UG/sapt_pscore_coherence.h new file mode 100644 index 000000000..a3211df54 --- /dev/null +++ b/moses/TranslationModel/UG/sapt_pscore_coherence.h @@ -0,0 +1,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); + } + }; + } +} |