From b83fc49a1f705dd8d65eded1221836a87fa95913 Mon Sep 17 00:00:00 2001 From: hieuhoang1972 Date: Thu, 23 Sep 2010 11:05:38 +0000 Subject: [PATCH] make class name consistent for chart & pb decoders git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@3553 1f5c12ca-751b-0410-a591-d2e778427230 --- moses-chart/src/ChartTranslationOption.cpp | 3 ++- moses-chart/src/ChartTranslationOption.h | 3 +-- moses/src/ChartRule.h | 9 +++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/moses-chart/src/ChartTranslationOption.cpp b/moses-chart/src/ChartTranslationOption.cpp index 1fa452f6b..a028a5ddf 100644 --- a/moses-chart/src/ChartTranslationOption.cpp +++ b/moses-chart/src/ChartTranslationOption.cpp @@ -34,10 +34,11 @@ namespace MosesChart TranslationOption::TranslationOption(const WordsRange &wordsRange , const ChartRule &rule) :m_rule(rule) -,m_wordsRange(wordsRange) { //assert(wordsRange.GetStartPos() == rule.GetWordsConsumed().front()->GetWordsRange().GetStartPos()); assert(wordsRange.GetEndPos() == rule.GetLastWordConsumed().GetWordsRange().GetEndPos()); + + rule.SetWordsRange(wordsRange); } TranslationOption::~TranslationOption() diff --git a/moses-chart/src/ChartTranslationOption.h b/moses-chart/src/ChartTranslationOption.h index aca0e0333..c6b6f0189 100644 --- a/moses-chart/src/ChartTranslationOption.h +++ b/moses-chart/src/ChartTranslationOption.h @@ -36,7 +36,6 @@ class TranslationOption protected: const Moses::ChartRule &m_rule; /*< output phrase when using this translation option */ - const Moses::WordsRange &m_wordsRange; public: TranslationOption(const Moses::WordsRange &wordsRange , const Moses::ChartRule &chartRule); @@ -53,7 +52,7 @@ public: { return m_rule.GetLastWordConsumed(); } const Moses::WordsRange &GetSourceWordsRange() const - { return m_wordsRange; } + { return m_rule.GetSourceWordsRange(); } /** return estimate of total cost of this option */ inline size_t GetArity() const diff --git a/moses/src/ChartRule.h b/moses/src/ChartRule.h index 07eb2b9d5..feee5c959 100644 --- a/moses/src/ChartRule.h +++ b/moses/src/ChartRule.h @@ -47,6 +47,7 @@ protected: Usually filled with NOT_KNOWN, unless the pos is a non-term, in which case its filled with its index */ + mutable const WordsRange *m_wordsRange; ChartRule(const ChartRule ©); // not implmenented @@ -69,6 +70,14 @@ public: { return m_wordsConsumedTargetOrder; } void CreateNonTermIndex(); + + // used inside chart decoder. must make words range mutable. hack + void SetWordsRange(const WordsRange &range) const + { m_wordsRange = ⦥ } + + const Moses::WordsRange &GetSourceWordsRange() const + { return *m_wordsRange; } + }; }