diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-08-08 18:03:01 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-08-08 18:03:01 +0400 |
commit | a60bbbf892c982c5a93549142166db0d654c7e11 (patch) | |
tree | 74d079d39207e108abd42fb852451046bee9adc9 /moses/DecodeStepTranslation.cpp | |
parent | 88f888f5344b51161ab66afc53033eb8c665d3fd (diff) |
consistently set source phrase in translation options as soon as the trans opt is created
Diffstat (limited to 'moses/DecodeStepTranslation.cpp')
-rw-r--r-- | moses/DecodeStepTranslation.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/moses/DecodeStepTranslation.cpp b/moses/DecodeStepTranslation.cpp index 4f88b223a..622a2247f 100644 --- a/moses/DecodeStepTranslation.cpp +++ b/moses/DecodeStepTranslation.cpp @@ -49,7 +49,7 @@ void DecodeStepTranslation::Process(const TranslationOption &inputPartialTranslO , PartialTranslOptColl &outputPartialTranslOptColl , TranslationOptionCollection *toc , bool adhereTableLimit - , const Phrase &src + , const Phrase &sourcePhrase , const TargetPhraseCollection *phraseColl) const { if (inputPartialTranslOpt.GetTargetPhrase().GetSize() == 0) { @@ -84,12 +84,13 @@ void DecodeStepTranslation::Process(const TranslationOption &inputPartialTranslO } outPhrase.Merge(targetPhrase, m_newOutputFactors); - outPhrase.Evaluate(src, m_featuresToApply); // need to do this as all non-transcores would be screwed up - + outPhrase.Evaluate(sourcePhrase, m_featuresToApply); // need to do this as all non-transcores would be screwed up TranslationOption *newTransOpt = new TranslationOption(sourceWordsRange, outPhrase); assert(newTransOpt != NULL); + newTransOpt->SetSourcePhrase(sourcePhrase); + outputPartialTranslOptColl.Add(newTransOpt ); } @@ -103,6 +104,7 @@ void DecodeStepTranslation::ProcessInitialTranslation( const InputType &source ,PartialTranslOptColl &outputPartialTranslOptColl , size_t startPos, size_t endPos, bool adhereTableLimit + , const Phrase &sourcePhrase , const TargetPhraseCollection *phraseColl) const { const PhraseDictionary* phraseDictionary = GetPhraseDictionaryFeature(); @@ -125,6 +127,8 @@ void DecodeStepTranslation::ProcessInitialTranslation( const TargetPhrase &targetPhrase = **iterTargetPhrase; TranslationOption *transOpt = new TranslationOption(wordsRange, targetPhrase); + transOpt->SetSourcePhrase(sourcePhrase); + outputPartialTranslOptColl.Add (transOpt); VERBOSE(3,"\t" << targetPhrase << "\n"); @@ -208,7 +212,7 @@ void DecodeStepTranslation::ProcessLegacy(const TranslationOption &inputPartialT , PartialTranslOptColl &outputPartialTranslOptColl , TranslationOptionCollection *toc , bool adhereTableLimit - , const Phrase &src) const + , const Phrase &sourcePhrase) const { if (inputPartialTranslOpt.GetTargetPhrase().GetSize() == 0) { // word deletion @@ -246,12 +250,14 @@ void DecodeStepTranslation::ProcessLegacy(const TranslationOption &inputPartialT } outPhrase.Merge(targetPhrase, m_newOutputFactors); - outPhrase.Evaluate(src, m_featuresToApply); // need to do this as all non-transcores would be screwed up + outPhrase.Evaluate(sourcePhrase, m_featuresToApply); // need to do this as all non-transcores would be screwed up TranslationOption *newTransOpt = new TranslationOption(sourceWordsRange, outPhrase); assert(newTransOpt != NULL); + newTransOpt->SetSourcePhrase(sourcePhrase); + outputPartialTranslOptColl.Add(newTransOpt ); } |