diff options
author | Matthias Huck <huck@i6.informatik.rwth-aachen.de> | 2015-01-07 21:53:29 +0300 |
---|---|---|
committer | Matthias Huck <huck@i6.informatik.rwth-aachen.de> | 2015-01-07 21:53:29 +0300 |
commit | ee787c33c0aba47b2a8b62fa1403906096142ef9 (patch) | |
tree | a4f7222505e3affd47dda6dd7c0dccd13e19ea9a | |
parent | 3e1ddaf71967b855cbc827e7b14f7e9e29c0c0fb (diff) | |
parent | 7123d1cc800b71ea1f6b1ba2a3013396641befde (diff) |
Merge branch 'master' of https://github.com/moses-smt/mosesdecoder
4 files changed, 10 insertions, 4 deletions
diff --git a/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemory.cpp b/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemory.cpp index f229a0f4b..bafbb101f 100644 --- a/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemory.cpp +++ b/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemory.cpp @@ -80,12 +80,12 @@ void ChartRuleLookupManagerMemory::GetChartRuleCollection( } // copy temporarily stored rules to out collection - CompletedRuleCollection rules = m_completedRules[absEndPos]; + CompletedRuleCollection & rules = m_completedRules[absEndPos]; for (vector<CompletedRule*>::const_iterator iter = rules.begin(); iter != rules.end(); ++iter) { outColl.Add((*iter)->GetTPC(), (*iter)->GetStackVector(), range); } - m_completedRules[absEndPos].Clear(); + rules.Clear(); } diff --git a/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemoryPerSentence.cpp b/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemoryPerSentence.cpp index 23d357f10..9e110e3f8 100644 --- a/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemoryPerSentence.cpp +++ b/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemoryPerSentence.cpp @@ -80,12 +80,12 @@ void ChartRuleLookupManagerMemoryPerSentence::GetChartRuleCollection( } // copy temporarily stored rules to out collection - CompletedRuleCollection rules = m_completedRules[absEndPos]; + CompletedRuleCollection & rules = m_completedRules[absEndPos]; for (vector<CompletedRule*>::const_iterator iter = rules.begin(); iter != rules.end(); ++iter) { outColl.Add((*iter)->GetTPC(), (*iter)->GetStackVector(), range); } - m_completedRules[absEndPos].Clear(); + rules.Clear(); } diff --git a/moses/TranslationModel/CYKPlusParser/CompletedRuleCollection.cpp b/moses/TranslationModel/CYKPlusParser/CompletedRuleCollection.cpp index 332a01499..fb9107d9e 100644 --- a/moses/TranslationModel/CYKPlusParser/CompletedRuleCollection.cpp +++ b/moses/TranslationModel/CYKPlusParser/CompletedRuleCollection.cpp @@ -32,6 +32,11 @@ CompletedRuleCollection::CompletedRuleCollection() : m_ruleLimit(StaticData::Ins m_scoreThreshold = numeric_limits<float>::infinity(); } +CompletedRuleCollection::~CompletedRuleCollection() +{ + Clear(); +} + // copies some functionality (pruning) from ChartTranslationOptionList::Add void CompletedRuleCollection::Add(const TargetPhraseCollection &tpc, const StackVec &stackVec, diff --git a/moses/TranslationModel/CYKPlusParser/CompletedRuleCollection.h b/moses/TranslationModel/CYKPlusParser/CompletedRuleCollection.h index 20e8d0e16..84b583df6 100644 --- a/moses/TranslationModel/CYKPlusParser/CompletedRuleCollection.h +++ b/moses/TranslationModel/CYKPlusParser/CompletedRuleCollection.h @@ -75,6 +75,7 @@ struct CompletedRuleCollection { public: CompletedRuleCollection(); + ~CompletedRuleCollection(); CompletedRuleCollection(const CompletedRuleCollection &old) : m_collection(old.m_collection) |