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
path: root/moses
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2015-02-24 15:35:12 +0300
committerHieu Hoang <hieuhoang@gmail.com>2015-02-24 15:35:12 +0300
commit28fbf07c37589c1cb118d83842f31c969cf5b228 (patch)
tree028f9120d7c490cca53a0ada6053df8c6bb7372b /moses
parent59986d8c8159abe783d7ffb16507cd2c63531732 (diff)
parentce3bd8851627de2ea92b6d2292544ce870c5f8de (diff)
Merge branch 'master' of github.com:moses-smt/mosesdecoder
Diffstat (limited to 'moses')
-rw-r--r--moses/FF/PhraseOrientationFeature.cpp4
-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
-rw-r--r--moses/TranslationTask.cpp3
5 files changed, 14 insertions, 12 deletions
diff --git a/moses/FF/PhraseOrientationFeature.cpp b/moses/FF/PhraseOrientationFeature.cpp
index e13811192..5cb252270 100644
--- a/moses/FF/PhraseOrientationFeature.cpp
+++ b/moses/FF/PhraseOrientationFeature.cpp
@@ -363,7 +363,7 @@ FFState* PhraseOrientationFeature::EvaluateWhenApplied(
}
}
- if ( reoClassData->firstNonTerminalIsBoundary ) {
+ if ( (nNT == 0) && reoClassData->firstNonTerminalIsBoundary ) {
// delay left-to-right scoring
FEATUREVERBOSE(3, "Delaying left-to-right scoring" << std::endl);
@@ -465,7 +465,7 @@ FFState* PhraseOrientationFeature::EvaluateWhenApplied(
}
}
- if ( reoClassData->lastNonTerminalIsBoundary ) {
+ if ( (nNT == currTarPhr.GetAlignNonTerm().GetSize()-1) && reoClassData->lastNonTerminalIsBoundary ) {
// delay right-to-left scoring
FEATUREVERBOSE(3, "Delaying right-to-left scoring" << std::endl);
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;
diff --git a/moses/TranslationTask.cpp b/moses/TranslationTask.cpp
index eff0588b6..800efbc5c 100644
--- a/moses/TranslationTask.cpp
+++ b/moses/TranslationTask.cpp
@@ -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);