Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Williams <philip.williams@mac.com>2015-02-23 14:12:00 +0300
committerPhil Williams <philip.williams@mac.com>2015-02-23 14:12:00 +0300
commit0bff50449e5dab52bddd46f28b450ddea5f50125 (patch)
treebda98d349aa1091974767984fb06767099648246 /moses/Syntax
parent372d14a9e807b466cc74b3571f2466c4e742ed00 (diff)
Fix -search-algorithm 8
Diffstat (limited to 'moses/Syntax')
-rw-r--r--moses/Syntax/F2S/Manager-inl.h2
-rw-r--r--moses/Syntax/T2S/Manager-inl.h14
-rw-r--r--moses/Syntax/T2S/Manager.h3
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;