diff options
author | Phil Williams <philip.williams@mac.com> | 2015-02-23 14:12:00 +0300 |
---|---|---|
committer | Phil Williams <philip.williams@mac.com> | 2015-02-23 14:12:00 +0300 |
commit | 0bff50449e5dab52bddd46f28b450ddea5f50125 (patch) | |
tree | bda98d349aa1091974767984fb06767099648246 /moses/Syntax | |
parent | 372d14a9e807b466cc74b3571f2466c4e742ed00 (diff) |
Fix -search-algorithm 8
Diffstat (limited to 'moses/Syntax')
-rw-r--r-- | moses/Syntax/F2S/Manager-inl.h | 2 | ||||
-rw-r--r-- | moses/Syntax/T2S/Manager-inl.h | 14 | ||||
-rw-r--r-- | moses/Syntax/T2S/Manager.h | 3 |
3 files changed, 11 insertions, 8 deletions
diff --git a/moses/Syntax/F2S/Manager-inl.h b/moses/Syntax/F2S/Manager-inl.h index 959cdcf0f..a422e8085 100644 --- a/moses/Syntax/F2S/Manager-inl.h +++ b/moses/Syntax/F2S/Manager-inl.h @@ -45,6 +45,8 @@ Manager<RuleMatcher>::Manager(const InputType &source) boost::shared_ptr<Forest> forest = boost::make_shared<Forest>(); m_rootVertex = T2S::InputTreeToForest(tmpTree, *forest); m_forest = forest; + } else { + UTIL_THROW2("ERROR: F2S::Manager requires input to be a tree or forest"); } } diff --git a/moses/Syntax/T2S/Manager-inl.h b/moses/Syntax/T2S/Manager-inl.h index 8736163b2..c0df884e1 100644 --- a/moses/Syntax/T2S/Manager-inl.h +++ b/moses/Syntax/T2S/Manager-inl.h @@ -27,10 +27,16 @@ namespace T2S { template<typename RuleMatcher> -Manager<RuleMatcher>::Manager(const TreeInput &source) +Manager<RuleMatcher>::Manager(const InputType &source) : Syntax::Manager(source) - , m_treeSource(source) { + if (const TreeInput *p = dynamic_cast<const TreeInput*>(&source)) { + // Construct the InputTree. + InputTreeBuilder builder; + builder.Build(*p, "Q", m_inputTree); + } else { + UTIL_THROW2("ERROR: T2S::Manager requires input to be a tree"); + } } template<typename RuleMatcher> @@ -94,10 +100,6 @@ void Manager<RuleMatcher>::Decode() const std::size_t ruleLimit = staticData.GetRuleLimit(); const std::size_t stackLimit = staticData.GetMaxHypoStackSize(); - // Construct the InputTree. - InputTreeBuilder builder; - builder.Build(m_treeSource, "Q", m_inputTree); - // Initialize the stacks. InitializeStacks(); diff --git a/moses/Syntax/T2S/Manager.h b/moses/Syntax/T2S/Manager.h index e241ea476..c8421477c 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 TreeInput &); + Manager(const InputType &); void Decode(); @@ -51,7 +51,6 @@ private: void RecombineAndSort(const std::vector<SHyperedge*> &, SVertexStack &); - const TreeInput &m_treeSource; InputTree m_inputTree; F2S::PVertexToStackMap m_stackMap; boost::shared_ptr<RuleTrie> m_glueRuleTrie; |