Make sure source phrase is initialised

This commit is contained in:
Barry Haddow 2012-09-04 19:07:57 +01:00
parent 54433bb221
commit 1862fe54cc

View File

@ -107,7 +107,6 @@ bool PhraseDictionaryMemory::Load(const std::vector<FactorType> &input
//target
std::auto_ptr<TargetPhrase> targetPhrase(new TargetPhrase(Output));
targetPhrase->SetSourcePhrase(sourcePhrase); // TODO(bhaddow): This is a dangling pointer
targetPhrase->CreateFromString(output, targetPhraseString, factorDelimiter);
scv.clear();
@ -175,6 +174,8 @@ bool PhraseDictionaryMemory::Load(const std::vector<FactorType> &input
preSourceNode->Add(targetPhrase.release());
preSourceString.assign(sourcePhraseString.data(), sourcePhraseString.size());
}
//Now that the source phrase is ready, we give the target phrase a copy
targetPhrase->SetSourcePhrase(sourcePhrase);
}
// sort each target phrase collection