Fix -search-algorithm 8

This commit is contained in:
Phil Williams 2015-02-23 11:12:00 +00:00
parent 372d14a9e8
commit 0bff50449e
4 changed files with 12 additions and 10 deletions

View File

@ -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");
}
}

View File

@ -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();

View File

@ -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;

View File

@ -88,8 +88,7 @@ void TranslationTask::Run()
// SCFG-based tree-to-string decoding (ask Phil Williams)
typedef Syntax::F2S::RuleMatcherCallback Callback;
typedef Syntax::T2S::RuleMatcherSCFG<Callback> RuleMatcher;
const TreeInput *tree = NULL;
manager = new Syntax::T2S::Manager<RuleMatcher>(*tree);
manager = new Syntax::T2S::Manager<RuleMatcher>(*m_source);
} else if (staticData.GetSearchAlgorithm() == ChartIncremental) {
// Ken's incremental decoding
manager = new Incremental::Manager(*m_source);