This commit is contained in:
Hieu Hoang 2013-07-08 19:02:18 +01:00
parent 8d857fa26e
commit 852242b804
3 changed files with 24 additions and 23 deletions

View File

@ -95,10 +95,12 @@ public:
return 1;
}
PhraseNode &GetRootSourceNode()
{ return *m_rootSourceNode; }
const PhraseNode &GetRootSourceNode() const
{ return *m_rootSourceNode; }
PhraseNode &GetRootSourceNode() {
return *m_rootSourceNode;
}
const PhraseNode &GetRootSourceNode() const {
return *m_rootSourceNode;
}
UINT64 GetMisc(const std::string &key) const;

View File

@ -265,9 +265,9 @@ Moses::TargetPhrase *TargetPhrase::ConvertToMoses(const std::vector<Moses::Facto
ret->SetAlignNonTerm(alignNonTerm);
if (isSyntax) {
Moses::Word *lhsTarget = new Moses::Word(true);
GetWord(GetSize() - 1).ConvertToMoses(outputFactors, vocab, *lhsTarget);
ret->SetTargetLHS(lhsTarget);
Moses::Word *lhsTarget = new Moses::Word(true);
GetWord(GetSize() - 1).ConvertToMoses(outputFactors, vocab, *lhsTarget);
ret->SetTargetLHS(lhsTarget);
}
// set source phrase

View File

@ -124,27 +124,26 @@ void PhraseDictionaryOnDisk::SetTargetPhraseFromPtMatrix(const std::vector<Input
if (lastWordOnDisk == NULL) {
// OOV according to this phrase table. Not possible to extend
node.SetTargetPhrases(*this, NULL, NULL);
}
else {
const OnDiskPt::PhraseNode *ptNode = prevPtNode->GetChild(*lastWordOnDisk, wrapper);
if (ptNode) {
vector<float> weightT = StaticData::Instance().GetWeights(this);
OnDiskPt::Vocab &vocab = wrapper.GetVocab();
node.SetTargetPhrases(*this, NULL, NULL);
} else {
const OnDiskPt::PhraseNode *ptNode = prevPtNode->GetChild(*lastWordOnDisk, wrapper);
if (ptNode) {
vector<float> weightT = StaticData::Instance().GetWeights(this);
OnDiskPt::Vocab &vocab = wrapper.GetVocab();
const OnDiskPt::TargetPhraseCollection *targetPhrasesOnDisk = ptNode->GetTargetPhraseCollection(m_tableLimit, wrapper);
TargetPhraseCollection *targetPhrases
= targetPhrasesOnDisk->ConvertToMoses(m_input, m_output, *this, weightT, vocab, false);
const OnDiskPt::TargetPhraseCollection *targetPhrasesOnDisk = ptNode->GetTargetPhraseCollection(m_tableLimit, wrapper);
TargetPhraseCollection *targetPhrases
= targetPhrasesOnDisk->ConvertToMoses(m_input, m_output, *this, weightT, vocab, false);
node.SetTargetPhrases(*this, targetPhrases, ptNode);
node.SetTargetPhrases(*this, targetPhrases, ptNode);
delete targetPhrasesOnDisk;
delete targetPhrasesOnDisk;
} else {
node.SetTargetPhrases(*this, NULL, NULL);
}
} else {
node.SetTargetPhrases(*this, NULL, NULL);
}
delete lastWordOnDisk;
delete lastWordOnDisk;
}
}
}