diff options
author | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-10-28 13:26:41 +0300 |
---|---|---|
committer | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-10-28 13:26:41 +0300 |
commit | 6a2e6feeed434966ba72adc9f26d7b3496070b87 (patch) | |
tree | e5d391f97ac84817851f906e85a3eed5a6cd7c97 /moses/TargetPhrase.cpp | |
parent | 50c109699618ef4372ba78c4e3bf7e788c6a0884 (diff) |
Context weights now live in the ContextScope, not any more on TranslationTask.
TargetPhrase now has weak ptr to ContextScope, not to TranslationTask any more,
because TargetPhrases can outlive the scope of a Translation Task.
Diffstat (limited to 'moses/TargetPhrase.cpp')
-rw-r--r-- | moses/TargetPhrase.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/moses/TargetPhrase.cpp b/moses/TargetPhrase.cpp index cd9e579c3..c6bab251b 100644 --- a/moses/TargetPhrase.cpp +++ b/moses/TargetPhrase.cpp @@ -1,5 +1,4 @@ -// $Id$ - +// -*- mode: c++; indent-tabs-mode: nil; tab-width:2 -*- /*********************************************************************** Moses - factored phrase-based language decoder Copyright (C) 2006 University of Edinburgh @@ -60,7 +59,6 @@ TargetPhrase::TargetPhrase( std::string out_string, const PhraseDictionary *pt) TargetPhrase::TargetPhrase(ttasksptr& ttask, std::string out_string, const PhraseDictionary *pt) :Phrase(0) - , m_ttask(ttask) , m_fullScore(0.0) , m_futureScore(0.0) , m_alignTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo()) @@ -69,7 +67,8 @@ TargetPhrase::TargetPhrase(ttasksptr& ttask, std::string out_string, const Phras , m_ruleSource(NULL) , m_container(pt) { - + if (ttask) m_scope = ttask->GetScope(); + //ACAT const StaticData &staticData = StaticData::Instance(); // XXX should this really be InputFactorOrder??? @@ -79,8 +78,7 @@ TargetPhrase::TargetPhrase(ttasksptr& ttask, std::string out_string, const Phras } TargetPhrase::TargetPhrase(ttasksptr& ttask, const PhraseDictionary *pt) - :Phrase() - , m_ttask(ttask) + : Phrase() , m_fullScore(0.0) , m_futureScore(0.0) , m_alignTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo()) @@ -89,6 +87,7 @@ TargetPhrase::TargetPhrase(ttasksptr& ttask, const PhraseDictionary *pt) , m_ruleSource(NULL) , m_container(pt) { + if (ttask) m_scope = ttask->GetScope(); } TargetPhrase::TargetPhrase(ttasksptr& ttask, const Phrase &phrase, const PhraseDictionary *pt) @@ -99,9 +98,9 @@ TargetPhrase::TargetPhrase(ttasksptr& ttask, const Phrase &phrase, const PhraseD , m_alignNonTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo()) , m_lhsTarget(NULL) , m_ruleSource(NULL) - , m_ttask(ttask) , m_container(pt) { + if (ttask) m_scope = ttask->GetScope(); } TargetPhrase::TargetPhrase(const PhraseDictionary *pt) @@ -137,7 +136,7 @@ TargetPhrase::TargetPhrase(const TargetPhrase ©) , m_alignTerm(copy.m_alignTerm) , m_alignNonTerm(copy.m_alignNonTerm) , m_properties(copy.m_properties) - , m_ttask(copy.m_ttask) + , m_scope(copy.m_scope) , m_container(copy.m_container) { if (copy.m_lhsTarget) { @@ -170,14 +169,14 @@ void TargetPhrase::WriteToRulePB(hgmert::Rule* pb) const } #endif -bool TargetPhrase::HasTtaskSPtr() const +bool TargetPhrase::HasScope() const { - return !m_ttask.expired(); + return !m_scope.expired(); // should actually never happen } -ttasksptr TargetPhrase::GetTtask() const +SPTR<ContextScope> TargetPhrase::GetScope() const { - return m_ttask.lock(); + return m_scope.lock(); } void TargetPhrase::EvaluateInIsolation(const Phrase &source) |