diff options
author | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-08-06 02:51:02 +0300 |
---|---|---|
committer | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-08-06 23:11:43 +0300 |
commit | 524109e2cabe5bd3ac693d3187e439885484a8c7 (patch) | |
tree | ed0bf9862bc6a50c327dd235efe3a038d2b0b2e2 /moses/Syntax | |
parent | fc10ad4afb812200d7529256797a10438cfaf1f3 (diff) |
Reorganisation of options.
The purpose of this effort is to have options local to the individual translation task,
so that they can be changed in the running system in a multi-threaded system.
Diffstat (limited to 'moses/Syntax')
-rw-r--r-- | moses/Syntax/F2S/Manager-inl.h | 6 | ||||
-rw-r--r-- | moses/Syntax/Manager.cpp | 8 | ||||
-rw-r--r-- | moses/Syntax/RuleTableFF.cpp | 8 | ||||
-rw-r--r-- | moses/Syntax/S2T/Manager-inl.h | 6 | ||||
-rw-r--r-- | moses/Syntax/T2S/Manager-inl.h | 6 |
5 files changed, 17 insertions, 17 deletions
diff --git a/moses/Syntax/F2S/Manager-inl.h b/moses/Syntax/F2S/Manager-inl.h index 55f85e888..077464208 100644 --- a/moses/Syntax/F2S/Manager-inl.h +++ b/moses/Syntax/F2S/Manager-inl.h @@ -59,9 +59,9 @@ void Manager<RuleMatcher>::Decode() const StaticData &staticData = StaticData::Instance(); // Get various pruning-related constants. - const std::size_t popLimit = staticData.GetCubePruningPopLimit(); + const std::size_t popLimit = staticData.options().cube.pop_limit; const std::size_t ruleLimit = staticData.GetRuleLimit(); - const std::size_t stackLimit = staticData.GetMaxHypoStackSize(); + const std::size_t stackLimit = staticData.options().search.stack_size; // Initialize the stacks. InitializeStacks(); @@ -254,7 +254,7 @@ void Manager<RuleMatcher>::ExtractKBest( // with 0 being 'unlimited.' This actually sets a large-ish limit in case // too many translations are identical. const StaticData &staticData = StaticData::Instance(); - const std::size_t nBestFactor = staticData.GetNBestFactor(); + const std::size_t nBestFactor = staticData.options().nbest.factor; std::size_t numDerivations = (nBestFactor == 0) ? k*1000 : k*nBestFactor; // Extract the derivations. diff --git a/moses/Syntax/Manager.cpp b/moses/Syntax/Manager.cpp index f84890927..f7df19d16 100644 --- a/moses/Syntax/Manager.cpp +++ b/moses/Syntax/Manager.cpp @@ -52,8 +52,8 @@ void Manager::OutputNBest(OutputCollector *collector) const long translationId = m_source.GetTranslationId(); KBestExtractor::KBestVec nBestList; - ExtractKBest(staticData.GetNBestSize(), nBestList, - staticData.GetDistinctNBest()); + ExtractKBest(staticData.options().nbest.nbest_size, nBestList, + staticData.options().nbest.only_distinct); OutputNBestList(collector, nBestList, translationId); } } @@ -90,8 +90,8 @@ void Manager::OutputNBestList(OutputCollector *collector, FixPrecision(out); } - bool includeWordAlignment = staticData.PrintAlignmentInfoInNbest(); - bool PrintNBestTrees = staticData.PrintNBestTrees(); + bool includeWordAlignment = staticData.options().nbest.include_alignment_info; + bool PrintNBestTrees = staticData.options().nbest.print_trees; // PrintNBestTrees(); for (KBestExtractor::KBestVec::const_iterator p = nBestList.begin(); p != nBestList.end(); ++p) { diff --git a/moses/Syntax/RuleTableFF.cpp b/moses/Syntax/RuleTableFF.cpp index dd24493f0..fd203b2fc 100644 --- a/moses/Syntax/RuleTableFF.cpp +++ b/moses/Syntax/RuleTableFF.cpp @@ -31,14 +31,14 @@ void RuleTableFF::Load() SetFeaturesToApply(); const StaticData &staticData = StaticData::Instance(); - if (staticData.GetSearchAlgorithm() == SyntaxF2S || - staticData.GetSearchAlgorithm() == SyntaxT2S) { + if (staticData.options().search.algo == SyntaxF2S || + staticData.options().search.algo == SyntaxT2S) { F2S::HyperTree *trie = new F2S::HyperTree(this); F2S::HyperTreeLoader loader; loader.Load(m_input, m_output, m_filePath, *this, *trie, m_sourceTerminalSet); m_table = trie; - } else if (staticData.GetSearchAlgorithm() == SyntaxS2T) { + } else if (staticData.options().search.algo == SyntaxS2T) { S2TParsingAlgorithm algorithm = staticData.GetS2TParsingAlgorithm(); if (algorithm == RecursiveCYKPlus) { S2T::RuleTrieCYKPlus *trie = new S2T::RuleTrieCYKPlus(this); @@ -53,7 +53,7 @@ void RuleTableFF::Load() } else { UTIL_THROW2("ERROR: unhandled S2T parsing algorithm"); } - } else if (staticData.GetSearchAlgorithm() == SyntaxT2S_SCFG) { + } else if (staticData.options().search.algo == SyntaxT2S_SCFG) { T2S::RuleTrie *trie = new T2S::RuleTrie(this); T2S::RuleTrieLoader loader; loader.Load(m_input, m_output, m_filePath, *this, *trie); diff --git a/moses/Syntax/S2T/Manager-inl.h b/moses/Syntax/S2T/Manager-inl.h index ef08752b6..4963ec788 100644 --- a/moses/Syntax/S2T/Manager-inl.h +++ b/moses/Syntax/S2T/Manager-inl.h @@ -162,9 +162,9 @@ void Manager<Parser>::Decode() const StaticData &staticData = StaticData::Instance(); // Get various pruning-related constants. - const std::size_t popLimit = staticData.GetCubePruningPopLimit(); + const std::size_t popLimit = staticData.options().cube.pop_limit; const std::size_t ruleLimit = staticData.GetRuleLimit(); - const std::size_t stackLimit = staticData.GetMaxHypoStackSize(); + const std::size_t stackLimit = staticData.options().search.stack_size; // Initialise the PChart and SChart. InitializeCharts(); @@ -302,7 +302,7 @@ void Manager<Parser>::ExtractKBest( // with 0 being 'unlimited.' This actually sets a large-ish limit in case // too many translations are identical. const StaticData &staticData = StaticData::Instance(); - const std::size_t nBestFactor = staticData.GetNBestFactor(); + const std::size_t nBestFactor = staticData.options().nbest.factor; std::size_t numDerivations = (nBestFactor == 0) ? k*1000 : k*nBestFactor; // Extract the derivations. diff --git a/moses/Syntax/T2S/Manager-inl.h b/moses/Syntax/T2S/Manager-inl.h index 90ecb35bf..344d804e7 100644 --- a/moses/Syntax/T2S/Manager-inl.h +++ b/moses/Syntax/T2S/Manager-inl.h @@ -96,9 +96,9 @@ void Manager<RuleMatcher>::Decode() const StaticData &staticData = StaticData::Instance(); // Get various pruning-related constants. - const std::size_t popLimit = staticData.GetCubePruningPopLimit(); + const std::size_t popLimit = this->options().cube.pop_limit; const std::size_t ruleLimit = staticData.GetRuleLimit(); - const std::size_t stackLimit = staticData.GetMaxHypoStackSize(); + const std::size_t stackLimit = this->options().search.stack_size; // Initialize the stacks. InitializeStacks(); @@ -214,7 +214,7 @@ void Manager<RuleMatcher>::ExtractKBest( // with 0 being 'unlimited.' This actually sets a large-ish limit in case // too many translations are identical. const StaticData &staticData = StaticData::Instance(); - const std::size_t nBestFactor = staticData.GetNBestFactor(); + const std::size_t nBestFactor = staticData.options().nbest.factor; std::size_t numDerivations = (nBestFactor == 0) ? k*1000 : k*nBestFactor; // Extract the derivations. |