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/Manager.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/Manager.cpp')
-rw-r--r-- | moses/Manager.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/moses/Manager.cpp b/moses/Manager.cpp index ec4f57739..c16aaa407 100644 --- a/moses/Manager.cpp +++ b/moses/Manager.cpp @@ -71,7 +71,7 @@ Manager::Manager(ttasksptr const& ttask) m_transOptColl = source->CreateTranslationOptionCollection(ttask); const StaticData &staticData = StaticData::Instance(); - SearchAlgorithm searchAlgorithm = staticData.GetSearchAlgorithm(); + SearchAlgorithm searchAlgorithm = staticData.options().search.algo; m_search = Search::CreateSearch(*this, *source, searchAlgorithm, *m_transOptColl); @@ -264,7 +264,7 @@ void Manager::CalcNBest(size_t count, TrellisPathList &ret,bool onlyDistinct) co } // factor defines stopping point for distinct n-best list if too many candidates identical - size_t nBestFactor = StaticData::Instance().GetNBestFactor(); + size_t nBestFactor = StaticData::Instance().options().nbest.factor; if (nBestFactor < 1) nBestFactor = 1000; // 0 = unlimited // MAIN loop @@ -288,7 +288,7 @@ void Manager::CalcNBest(size_t count, TrellisPathList &ret,bool onlyDistinct) co if(onlyDistinct) { - const size_t nBestFactor = StaticData::Instance().GetNBestFactor(); + const size_t nBestFactor = StaticData::Instance().options().nbest.factor; if (nBestFactor > 0) contenders.Prune(count * nBestFactor); } else { @@ -1548,10 +1548,10 @@ void Manager::OutputBest(OutputCollector *collector) const // lattice MBR if (staticData.UseLatticeMBR()) { - if (staticData.IsNBestEnabled()) { + if (staticData.options().nbest.enabled) { //lattice mbr nbest vector<LatticeMBRSolution> solutions; - size_t n = min(nBestSize, staticData.GetNBestSize()); + size_t n = min(nBestSize, staticData.options().nbest.nbest_size); getLatticeMBRNBest(*this,nBestList,solutions,n); OutputLatticeMBRNBest(m_latticeNBestOut, solutions, translationId); } else { @@ -1609,14 +1609,16 @@ void Manager::OutputNBest(OutputCollector *collector) const long translationId = m_source.GetTranslationId(); if (staticData.UseLatticeMBR()) { - if (staticData.IsNBestEnabled()) { + if (staticData.options().nbest.enabled) { collector->Write(translationId, m_latticeNBestOut.str()); } } else { TrellisPathList nBestList; ostringstream out; - CalcNBest(staticData.GetNBestSize(), nBestList,staticData.GetDistinctNBest()); - OutputNBest(out, nBestList, staticData.GetOutputFactorOrder(), m_source.GetTranslationId(), + CalcNBest(staticData.options().nbest.nbest_size, nBestList, + staticData.options().nbest.only_distinct); + OutputNBest(out, nBestList, staticData.GetOutputFactorOrder(), + m_source.GetTranslationId(), staticData.GetReportSegmentation()); collector->Write(m_source.GetTranslationId(), out.str()); } @@ -1630,9 +1632,10 @@ void Manager::OutputNBest(std::ostream& out , char reportSegmentation) const { const StaticData &staticData = StaticData::Instance(); - bool reportAllFactors = staticData.GetReportAllFactorsNBest(); - bool includeSegmentation = staticData.NBestIncludesSegmentation(); - bool includeWordAlignment = staticData.PrintAlignmentInfoInNbest(); + NBestOptions const& nbo = staticData.options().nbest; + bool reportAllFactors = nbo.include_all_factors; + bool includeSegmentation = nbo.include_segmentation; + bool includeWordAlignment = nbo.include_alignment_info; TrellisPathList::const_iterator iter; for (iter = nBestList.begin() ; iter != nBestList.end() ; ++iter) { |