diff options
author | Patrick Simianer <p@simianer.de> | 2011-11-03 00:38:49 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2011-11-03 00:38:49 +0100 |
commit | bcfb20c1e1e9434ae04a30240859db6a353457d0 (patch) | |
tree | 4611721111f4fef5bd132ed3236b820c4e16fa9c /gi/pf/base_measures.h | |
parent | 4df1aea9e6edce1c79059d3310d55947be0a302e (diff) | |
parent | 6de8f58cd13813bf33af4903bf386439683c0fd6 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'gi/pf/base_measures.h')
-rw-r--r-- | gi/pf/base_measures.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gi/pf/base_measures.h b/gi/pf/base_measures.h index df17aa62..7ce7e2e6 100644 --- a/gi/pf/base_measures.h +++ b/gi/pf/base_measures.h @@ -97,6 +97,37 @@ struct PhraseJointBase { const prob_t kUNIFORM_TARGET; }; +struct PhraseJointBase_BiDir { + explicit PhraseJointBase_BiDir(const Model1& m1, + const Model1& im1, + const double m1mixture, + const unsigned vocab_e_size, + const unsigned vocab_f_size) : + model1(m1), + invmodel1(im1), + kM1MIXTURE(m1mixture), + kUNIFORM_MIXTURE(1.0 - m1mixture), + kUNIFORM_SOURCE(1.0 / vocab_f_size), + kUNIFORM_TARGET(1.0 / vocab_e_size) { + assert(m1mixture >= 0.0 && m1mixture <= 1.0); + assert(vocab_e_size > 0); + } + + // return p0 of rule.e_ | rule.f_ + prob_t operator()(const TRule& rule) const { + return p0(rule.f_, rule.e_, 0, 0); + } + + prob_t p0(const std::vector<WordID>& vsrc, const std::vector<WordID>& vtrg, int start_src, int start_trg) const; + + const Model1& model1; + const Model1& invmodel1; + const prob_t kM1MIXTURE; // Model 1 mixture component + const prob_t kUNIFORM_MIXTURE; // uniform mixture component + const prob_t kUNIFORM_SOURCE; + const prob_t kUNIFORM_TARGET; +}; + // base distribution for jump size multinomials // basically p(0) = 0 and then, p(1) is max, and then // you drop as you move to the max jump distance |