diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-08-07 13:28:28 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-08-07 13:28:28 +0400 |
commit | 66d4c2b0be0a41bb7eca5734913add627a193b7b (patch) | |
tree | e3cc5724da69172f8a1d8118216790c89988529e /moses/TranslationOption.cpp | |
parent | 7a808a2edb5ce9304a2d6dd043188c64a1f23b46 (diff) |
source phrase is a pointer in translation options.
Diffstat (limited to 'moses/TranslationOption.cpp')
-rw-r--r-- | moses/TranslationOption.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/moses/TranslationOption.cpp b/moses/TranslationOption.cpp index ff77216be..42761f01b 100644 --- a/moses/TranslationOption.cpp +++ b/moses/TranslationOption.cpp @@ -34,6 +34,7 @@ namespace Moses TranslationOption::TranslationOption() :m_targetPhrase() +,m_sourcePhrase(NULL) ,m_sourceWordsRange(NOT_FOUND, NOT_FOUND) { } @@ -42,19 +43,12 @@ TranslationOption::TranslationOption() TranslationOption::TranslationOption(const WordsRange &wordsRange , const TargetPhrase &targetPhrase) : m_targetPhrase(targetPhrase) + , m_sourcePhrase(NULL) , m_sourceWordsRange(wordsRange) , m_futureScore(targetPhrase.GetFutureScore()) { } -TranslationOption::TranslationOption(const TranslationOption ©, const WordsRange &sourceWordsRange) - : m_targetPhrase(copy.m_targetPhrase) -//, m_sourcePhrase(new Phrase(*copy.m_sourcePhrase)) // TODO use when confusion network trans opt for confusion net properly implemented - , m_sourceWordsRange(sourceWordsRange) - , m_futureScore(copy.m_futureScore) - , m_lexReorderingScores(copy.m_lexReorderingScores) -{} - bool TranslationOption::IsCompatible(const Phrase& phrase, const std::vector<FactorType>& featuresToCheck) const { if (featuresToCheck.size() == 1) { @@ -83,6 +77,13 @@ void TranslationOption::Evaluate(const InputType &source) m_targetPhrase.Evaluate(source); } +const Phrase &TranslationOption::GetSourcePhrase() const +{ + CHECK(m_sourcePhrase); + return *m_sourcePhrase; +} + + TO_STRING_BODY(TranslationOption); // friend |