From fcc9bb1e60ddd3973eaccb978e30d2fdafe3e314 Mon Sep 17 00:00:00 2001 From: XapaJIaMnu Date: Thu, 25 Jun 2015 16:52:14 +0100 Subject: when using the suffix array PT, set the ttask in the targetPhrase --- moses/TranslationModel/UG/mmsapt.cpp | 16 +++++++++------- moses/TranslationModel/UG/mmsapt.h | 3 ++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/moses/TranslationModel/UG/mmsapt.cpp b/moses/TranslationModel/UG/mmsapt.cpp index f6f9fff50..7b212c8df 100644 --- a/moses/TranslationModel/UG/mmsapt.cpp +++ b/moses/TranslationModel/UG/mmsapt.cpp @@ -496,7 +496,8 @@ namespace Moses TargetPhrase* Mmsapt:: - mkTPhrase(Phrase const& src, + mkTPhrase(ttasksptr const& ttask, + Phrase const& src, PhrasePair* fix, PhrasePair* dyn, sptr > const& dynbt) const @@ -547,7 +548,8 @@ namespace Moses BOOST_FOREACH(sptr const& ff, m_active_ff_common) (*ff)(*dynbt, pool, &fvals); } - TargetPhrase* tp = new TargetPhrase(this); + + TargetPhrase* tp = new TargetPhrase(const_cast(ttask), this); Token const* x = fix ? fix->start2 : dyn->start2; uint32_t len = fix ? fix->len2 : dyn->len2; for (uint32_t k = 0; k < len; ++k, x = x->next()) @@ -687,12 +689,12 @@ namespace Moses while (i < ppfix.size() && k < ppdyn.size()) { int cmp = sorter.cmp(ppfix[i], ppdyn[k]); - if (cmp < 0) ret->Add(mkTPhrase(src,&ppfix[i++],NULL,dyn)); - else if (cmp == 0) ret->Add(mkTPhrase(src,&ppfix[i++],&ppdyn[k++],dyn)); - else ret->Add(mkTPhrase(src,NULL,&ppdyn[k++],dyn)); + if (cmp < 0) ret->Add(mkTPhrase(ttask,src,&ppfix[i++],NULL,dyn)); + else if (cmp == 0) ret->Add(mkTPhrase(ttask,src,&ppfix[i++],&ppdyn[k++],dyn)); + else ret->Add(mkTPhrase(ttask,src,NULL,&ppdyn[k++],dyn)); } - while (i < ppfix.size()) ret->Add(mkTPhrase(src,&ppfix[i++],NULL,dyn)); - while (k < ppdyn.size()) ret->Add(mkTPhrase(src,NULL,&ppdyn[k++],dyn)); + while (i < ppfix.size()) ret->Add(mkTPhrase(ttask,src,&ppfix[i++],NULL,dyn)); + while (k < ppdyn.size()) ret->Add(mkTPhrase(ttask,src,NULL,&ppdyn[k++],dyn)); if (m_tableLimit) ret->Prune(true, m_tableLimit); else ret->Prune(true,ret->GetSize()); diff --git a/moses/TranslationModel/UG/mmsapt.h b/moses/TranslationModel/UG/mmsapt.h index 5f688cfd8..81687cc50 100644 --- a/moses/TranslationModel/UG/mmsapt.h +++ b/moses/TranslationModel/UG/mmsapt.h @@ -149,7 +149,8 @@ namespace Moses mm2dtable_t COOCraw; TargetPhrase* - mkTPhrase(Phrase const& src, + mkTPhrase(ttasksptr const& ttask, + Phrase const& src, Moses::bitext::PhrasePair* fix, Moses::bitext::PhrasePair* dyn, sptr > const& dynbt) const; -- cgit v1.2.3