diff --git a/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemory.cpp b/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemory.cpp index b80d52353..e6fed90e5 100644 --- a/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemory.cpp +++ b/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemory.cpp @@ -154,12 +154,10 @@ void ChartRuleLookupManagerMemory::GetChartRuleCollection( const PhraseDictionaryNodeMemory &node = dottedRule.GetLastNode(); // look up target sides - const TargetPhraseCollection *tpc = node.GetTargetPhraseCollection(); + const TargetPhraseCollection &tpc = node.GetTargetPhraseCollection(); // add the fully expanded rule (with lexical target side) - if (tpc != NULL) { - AddCompletedRule(dottedRule, *tpc, range, outColl); - } + AddCompletedRule(dottedRule, tpc, range, outColl); } dottedRuleCol.Clear(relEndPos+1); diff --git a/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemoryPerSentence.cpp b/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemoryPerSentence.cpp index 86cd8c19f..00d7f323c 100644 --- a/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemoryPerSentence.cpp +++ b/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemoryPerSentence.cpp @@ -153,12 +153,10 @@ void ChartRuleLookupManagerMemoryPerSentence::GetChartRuleCollection( const PhraseDictionaryNodeMemory &node = dottedRule.GetLastNode(); // look up target sides - const TargetPhraseCollection *tpc = node.GetTargetPhraseCollection(); + const TargetPhraseCollection &tpc = node.GetTargetPhraseCollection(); // add the fully expanded rule (with lexical target side) - if (tpc != NULL) { - AddCompletedRule(dottedRule, *tpc, range, outColl); - } + AddCompletedRule(dottedRule, tpc, range, outColl); } dottedRuleCol.Clear(relEndPos+1); diff --git a/moses/TranslationModel/PhraseDictionaryMemory.cpp b/moses/TranslationModel/PhraseDictionaryMemory.cpp index 2caaa5aa9..97bb53e2b 100644 --- a/moses/TranslationModel/PhraseDictionaryMemory.cpp +++ b/moses/TranslationModel/PhraseDictionaryMemory.cpp @@ -51,7 +51,7 @@ TargetPhraseCollection &PhraseDictionaryMemory::GetOrCreateTargetPhraseCollectio , const Word *sourceLHS) { PhraseDictionaryNodeMemory &currNode = GetOrCreateNode(source, target, sourceLHS); - return currNode.GetOrCreateTargetPhraseCollection(); + return currNode.GetTargetPhraseCollection(); } const TargetPhraseCollection *PhraseDictionaryMemory::GetTargetPhraseCollection(const Phrase& sourceOrig) const @@ -70,7 +70,7 @@ const TargetPhraseCollection *PhraseDictionaryMemory::GetTargetPhraseCollection( return NULL; } - return currNode->GetTargetPhraseCollection(); + return &currNode->GetTargetPhraseCollection(); } PhraseDictionaryNodeMemory &PhraseDictionaryMemory::GetOrCreateNode(const Phrase &source diff --git a/moses/TranslationModel/PhraseDictionaryNodeMemory.h b/moses/TranslationModel/PhraseDictionaryNodeMemory.h index 563acdd17..c643bd5fc 100644 --- a/moses/TranslationModel/PhraseDictionaryNodeMemory.h +++ b/moses/TranslationModel/PhraseDictionaryNodeMemory.h @@ -133,10 +133,10 @@ public: const PhraseDictionaryNodeMemory *GetChild(const Word &sourceTerm) const; const PhraseDictionaryNodeMemory *GetChild(const Word &sourceNonTerm, const Word &targetNonTerm) const; - const TargetPhraseCollection *GetTargetPhraseCollection() const { - return &m_targetPhraseCollection; + const TargetPhraseCollection &GetTargetPhraseCollection() const { + return m_targetPhraseCollection; } - TargetPhraseCollection &GetOrCreateTargetPhraseCollection() { + TargetPhraseCollection &GetTargetPhraseCollection() { return m_targetPhraseCollection; } diff --git a/moses/TranslationModel/RuleTable/PhraseDictionaryFuzzyMatch.cpp b/moses/TranslationModel/RuleTable/PhraseDictionaryFuzzyMatch.cpp index bba5f9a85..a14d4922b 100644 --- a/moses/TranslationModel/RuleTable/PhraseDictionaryFuzzyMatch.cpp +++ b/moses/TranslationModel/RuleTable/PhraseDictionaryFuzzyMatch.cpp @@ -263,7 +263,7 @@ TargetPhraseCollection &PhraseDictionaryFuzzyMatch::GetOrCreateTargetPhraseColle , const Word *sourceLHS) { PhraseDictionaryNodeMemory &currNode = GetOrCreateNode(rootNode, source, target, sourceLHS); - return currNode.GetOrCreateTargetPhraseCollection(); + return currNode.GetTargetPhraseCollection(); } PhraseDictionaryNodeMemory &PhraseDictionaryFuzzyMatch::GetOrCreateNode(PhraseDictionaryNodeMemory &rootNode