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/ChartManager.cpp | |
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/ChartManager.cpp')
-rw-r--r-- | moses/ChartManager.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/moses/ChartManager.cpp b/moses/ChartManager.cpp index d59b68cc8..b1870791b 100644 --- a/moses/ChartManager.cpp +++ b/moses/ChartManager.cpp @@ -207,7 +207,7 @@ void ChartManager::CalcNBest( // 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) ? n*1000 : n*nBestFactor; // Extract the derivations. @@ -318,13 +318,14 @@ void ChartManager::OutputBest(OutputCollector *collector) const void ChartManager::OutputNBest(OutputCollector *collector) const { const StaticData &staticData = StaticData::Instance(); - size_t nBestSize = staticData.GetNBestSize(); + size_t nBestSize = staticData.options().nbest.nbest_size; if (nBestSize > 0) { const size_t translationId = m_source.GetTranslationId(); - VERBOSE(2,"WRITING " << nBestSize << " TRANSLATION ALTERNATIVES TO " << staticData.GetNBestFilePath() << endl); + VERBOSE(2,"WRITING " << nBestSize << " TRANSLATION ALTERNATIVES TO " + << staticData.options().nbest.output_file_path << endl); std::vector<boost::shared_ptr<ChartKBestExtractor::Derivation> > nBestList; - CalcNBest(nBestSize, nBestList,staticData.GetDistinctNBest()); + CalcNBest(nBestSize, nBestList,staticData.options().nbest.only_distinct); OutputNBestList(collector, nBestList, translationId); IFVERBOSE(2) { PrintUserTime("N-Best Hypotheses Generation Time:"); @@ -348,10 +349,9 @@ void ChartManager::OutputNBestList(OutputCollector *collector, FixPrecision(out); } - bool includeWordAlignment = - StaticData::Instance().PrintAlignmentInfoInNbest(); - - bool PrintNBestTrees = StaticData::Instance().PrintNBestTrees(); + NBestOptions const& nbo = StaticData::Instance().options().nbest; + bool includeWordAlignment = nbo.include_alignment_info; + bool PrintNBestTrees = nbo.print_trees; for (ChartKBestExtractor::KBestVec::const_iterator p = nBestList.begin(); p != nBestList.end(); ++p) { @@ -620,9 +620,9 @@ void ChartManager::OutputDetailedTranslationReport( if (staticData.IsDetailedAllTranslationReportingEnabled()) { const Sentence &sentence = dynamic_cast<const Sentence &>(m_source); - size_t nBestSize = staticData.GetNBestSize(); + size_t nBestSize = staticData.options().nbest.nbest_size; std::vector<boost::shared_ptr<ChartKBestExtractor::Derivation> > nBestList; - CalcNBest(nBestSize, nBestList, staticData.GetDistinctNBest()); + CalcNBest(nBestSize, nBestList, staticData.options().nbest.nbest_size); OutputDetailedAllTranslationReport(collector, nBestList, sentence, translationId); } |