diff options
author | Phil Williams <philip.williams@mac.com> | 2015-02-02 20:00:42 +0300 |
---|---|---|
committer | Phil Williams <philip.williams@mac.com> | 2015-02-02 20:07:54 +0300 |
commit | ac8f01bc3d2eae44c945d2da8d5fcd7a951fe009 (patch) | |
tree | 0454f784b8e787ce0f1bb46cee50be7b4c47ba01 /moses/TranslationTask.cpp | |
parent | c8ad84fa55f1f136d99fc4ff712e2aa421867c5d (diff) |
Partial merge of t2s branch (implements t2s and f2s algorithms)
Implements search algorithms 7, 8, and 9:
-search-algorithm 7
tree-to-string (STSG-based, currently a special-case of forest-to-string)
-search-algorithm 8
tree-to-string (SCFG-based)
-search-algorithm 9
forest-to-string (STSG-based)
Diffstat (limited to 'moses/TranslationTask.cpp')
-rw-r--r-- | moses/TranslationTask.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/moses/TranslationTask.cpp b/moses/TranslationTask.cpp index 3ff9b6b76..7c629db7f 100644 --- a/moses/TranslationTask.cpp +++ b/moses/TranslationTask.cpp @@ -10,8 +10,11 @@ #include "moses/Incremental.h" #include "mbr.h" +#include "moses/Syntax/F2S/RuleMatcherCallback.h" +#include "moses/Syntax/F2S/RuleMatcherHyperTree.h" #include "moses/Syntax/S2T/Parsers/RecursiveCYKPlusParser/RecursiveCYKPlusParser.h" #include "moses/Syntax/S2T/Parsers/Scope3Parser/Parser.h" +#include "moses/Syntax/T2S/RuleMatcherSCFG.h" #include "util/exception.hh" @@ -61,6 +64,12 @@ void TranslationTask::Run() if (!staticData.IsChart()) { // phrase-based manager = new Manager(*m_source); + } else if (staticData.GetSearchAlgorithm() == SyntaxF2S || + staticData.GetSearchAlgorithm() == SyntaxT2S) { + // STSG-based tree-to-string / forest-to-string decoding (ask Phil Williams) + typedef Syntax::F2S::RuleMatcherCallback Callback; + typedef Syntax::F2S::RuleMatcherHyperTree<Callback> RuleMatcher; + manager = new Syntax::F2S::Manager<RuleMatcher>(*m_source); } else if (staticData.GetSearchAlgorithm() == SyntaxS2T) { // new-style string-to-tree decoding (ask Phil Williams) S2TParsingAlgorithm algorithm = staticData.GetS2TParsingAlgorithm(); @@ -75,6 +84,12 @@ void TranslationTask::Run() } else { UTIL_THROW2("ERROR: unhandled S2T parsing algorithm"); } + } else if (staticData.GetSearchAlgorithm() == SyntaxT2S_SCFG) { + // 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); } else if (staticData.GetSearchAlgorithm() == ChartIncremental) { // Ken's incremental decoding manager = new Incremental::Manager(*m_source); |