diff options
author | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-03-26 19:37:04 +0300 |
---|---|---|
committer | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-03-26 19:37:04 +0300 |
commit | b3ff4ff13ac35293dcdb272f99b52388b560cb65 (patch) | |
tree | 1333c33a8a1ea4b8d4168ed17d8e20516fd2e737 /moses/Syntax | |
parent | d364211d9088667ddb98136e0c9a29b913c31717 (diff) |
Managers have now access to the entire translation task.
Diffstat (limited to 'moses/Syntax')
-rw-r--r-- | moses/Syntax/F2S/Manager-inl.h | 9 | ||||
-rw-r--r-- | moses/Syntax/F2S/Manager.h | 9 | ||||
-rw-r--r-- | moses/Syntax/Manager.cpp | 7 | ||||
-rw-r--r-- | moses/Syntax/Manager.h | 2 | ||||
-rw-r--r-- | moses/Syntax/S2T/Manager-inl.h | 12 | ||||
-rw-r--r-- | moses/Syntax/S2T/Manager.h | 2 | ||||
-rw-r--r-- | moses/Syntax/T2S/Manager-inl.h | 6 | ||||
-rw-r--r-- | moses/Syntax/T2S/Manager.h | 2 |
8 files changed, 24 insertions, 25 deletions
diff --git a/moses/Syntax/F2S/Manager-inl.h b/moses/Syntax/F2S/Manager-inl.h index a422e8085..6c289440c 100644 --- a/moses/Syntax/F2S/Manager-inl.h +++ b/moses/Syntax/F2S/Manager-inl.h @@ -1,3 +1,4 @@ +// -*- c++ -*- #pragma once #include "moses/DecodeGraph.h" @@ -32,13 +33,13 @@ namespace F2S { template<typename RuleMatcher> -Manager<RuleMatcher>::Manager(const InputType &source) - : Syntax::Manager(source) +Manager<RuleMatcher>::Manager(ttasksptr const& ttask) + : Syntax::Manager(ttask) { - if (const ForestInput *p = dynamic_cast<const ForestInput*>(&source)) { + if (const ForestInput *p = dynamic_cast<const ForestInput*>(&m_source)) { m_forest = p->GetForest(); m_rootVertex = p->GetRootVertex(); - } else if (const TreeInput *p = dynamic_cast<const TreeInput*>(&source)) { + } else if (const TreeInput *p = dynamic_cast<const TreeInput*>(&m_source)) { T2S::InputTreeBuilder builder; T2S::InputTree tmpTree; builder.Build(*p, "Q", tmpTree); diff --git a/moses/Syntax/F2S/Manager.h b/moses/Syntax/F2S/Manager.h index 3c7ff8da1..53f4cff13 100644 --- a/moses/Syntax/F2S/Manager.h +++ b/moses/Syntax/F2S/Manager.h @@ -30,17 +30,16 @@ template<typename RuleMatcher> class Manager : public Syntax::Manager { public: - Manager(const InputType &); + Manager(ttasksptr const& ttask); void Decode(); // Get the SHyperedge for the 1-best derivation. const SHyperedge *GetBestSHyperedge() const; - void ExtractKBest( - std::size_t k, - std::vector<boost::shared_ptr<KBestExtractor::Derivation> > &kBestList, - bool onlyDistinct=false) const; + typedef std::vector<boost::shared_ptr<KBestExtractor::Derivation> > kBestList_t; + void ExtractKBest(std::size_t k, kBestList_t& kBestList, + bool onlyDistinct=false) const; void OutputDetailedTranslationReport(OutputCollector *collector) const; diff --git a/moses/Syntax/Manager.cpp b/moses/Syntax/Manager.cpp index a11a0042f..f84890927 100644 --- a/moses/Syntax/Manager.cpp +++ b/moses/Syntax/Manager.cpp @@ -12,10 +12,9 @@ namespace Moses namespace Syntax { -Manager::Manager(const InputType &source) - : Moses::BaseManager(source) -{ -} +Manager::Manager(ttasksptr const& ttask) + : Moses::BaseManager(ttask) +{ } void Manager::OutputBest(OutputCollector *collector) const { diff --git a/moses/Syntax/Manager.h b/moses/Syntax/Manager.h index 8d814f604..ed36c7c1d 100644 --- a/moses/Syntax/Manager.h +++ b/moses/Syntax/Manager.h @@ -14,7 +14,7 @@ namespace Syntax class Manager : public BaseManager { public: - Manager(const InputType &); + Manager(ttasksptr const& ttask); // Virtual functions from Moses::BaseManager that are implemented the same // way for all Syntax managers. diff --git a/moses/Syntax/S2T/Manager-inl.h b/moses/Syntax/S2T/Manager-inl.h index 15594d589..ef08752b6 100644 --- a/moses/Syntax/S2T/Manager-inl.h +++ b/moses/Syntax/S2T/Manager-inl.h @@ -1,3 +1,4 @@ +// -*- c++ -*- #pragma once #include <iostream> @@ -30,12 +31,11 @@ namespace S2T { template<typename Parser> -Manager<Parser>::Manager(const InputType &source) - : Syntax::Manager(source) - , m_pchart(source.GetSize(), Parser::RequiresCompressedChart()) - , m_schart(source.GetSize()) -{ -} +Manager<Parser>::Manager(ttasksptr const& ttask) + : Syntax::Manager(ttask) + , m_pchart(m_source.GetSize(), Parser::RequiresCompressedChart()) + , m_schart(m_source.GetSize()) +{ } template<typename Parser> void Manager<Parser>::InitializeCharts() diff --git a/moses/Syntax/S2T/Manager.h b/moses/Syntax/S2T/Manager.h index 0961c8e77..711d6f9d8 100644 --- a/moses/Syntax/S2T/Manager.h +++ b/moses/Syntax/S2T/Manager.h @@ -30,7 +30,7 @@ template<typename Parser> class Manager : public Syntax::Manager { public: - Manager(const InputType &); + Manager(ttasksptr const& ttask); void Decode(); diff --git a/moses/Syntax/T2S/Manager-inl.h b/moses/Syntax/T2S/Manager-inl.h index c0df884e1..90ecb35bf 100644 --- a/moses/Syntax/T2S/Manager-inl.h +++ b/moses/Syntax/T2S/Manager-inl.h @@ -27,10 +27,10 @@ namespace T2S { template<typename RuleMatcher> -Manager<RuleMatcher>::Manager(const InputType &source) - : Syntax::Manager(source) +Manager<RuleMatcher>::Manager(ttasksptr const& ttask) + : Syntax::Manager(ttask) { - if (const TreeInput *p = dynamic_cast<const TreeInput*>(&source)) { + if (const TreeInput *p = dynamic_cast<const TreeInput*>(&m_source)) { // Construct the InputTree. InputTreeBuilder builder; builder.Build(*p, "Q", m_inputTree); diff --git a/moses/Syntax/T2S/Manager.h b/moses/Syntax/T2S/Manager.h index c8421477c..b2036aba0 100644 --- a/moses/Syntax/T2S/Manager.h +++ b/moses/Syntax/T2S/Manager.h @@ -30,7 +30,7 @@ template<typename RuleMatcher> class Manager : public Syntax::Manager { public: - Manager(const InputType &); + Manager(ttasksptr const& ttask); void Decode(); |