diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2015-01-02 21:40:15 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2015-01-02 21:40:15 +0300 |
commit | 0552a79b1e0c163d9adc042a5f83cdfdc1d20f84 (patch) | |
tree | 91150f79d0a7232ff4f501709d98017d91d21e06 /moses/TranslationTask.cpp | |
parent | 1ff52ebb0ec1acf8085e93622721dbb8fc7bff7d (diff) |
consistent constructor for all managers
Diffstat (limited to 'moses/TranslationTask.cpp')
-rw-r--r-- | moses/TranslationTask.cpp | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/moses/TranslationTask.cpp b/moses/TranslationTask.cpp index 6d29e3fab..ac12b9a29 100644 --- a/moses/TranslationTask.cpp +++ b/moses/TranslationTask.cpp @@ -50,6 +50,7 @@ void TranslationTask::RunPb() { // shorthand for "global data" const StaticData &staticData = StaticData::Instance(); + const size_t translationId = m_source->GetTranslationId(); // input sentence Sentence sentence; @@ -60,7 +61,7 @@ void TranslationTask::RunPb() // report thread number #if defined(WITH_THREADS) && defined(BOOST_HAS_PTHREADS) - TRACE_ERR("Translating line " << m_source->GetTranslationId() << " in thread id " << pthread_self() << endl); + TRACE_ERR("Translating line " << translationId << " in thread id " << pthread_self() << endl); #endif @@ -69,50 +70,52 @@ void TranslationTask::RunPb() // we still need to apply the decision rule (MAP, MBR, ...) Timer initTime; initTime.start(); - Manager manager(*m_source,staticData.GetSearchAlgorithm()); - VERBOSE(1, "Line " << m_source->GetTranslationId() << ": Initialize search took " << initTime << " seconds total" << endl); - manager.Decode(); + Manager *manager = new Manager(*m_source); + VERBOSE(1, "Line " << translationId << ": Initialize search took " << initTime << " seconds total" << endl); + manager->Decode(); // we are done with search, let's look what we got Timer additionalReportingTime; additionalReportingTime.start(); - manager.OutputBest(m_ioWrapper.GetSingleBestOutputCollector()); + manager->OutputBest(m_ioWrapper.GetSingleBestOutputCollector()); // output word graph - manager.OutputWordGraph(m_ioWrapper.GetWordGraphCollector()); + manager->OutputWordGraph(m_ioWrapper.GetWordGraphCollector()); // output search graph - manager.OutputSearchGraph(m_ioWrapper.GetSearchGraphOutputCollector()); + manager->OutputSearchGraph(m_ioWrapper.GetSearchGraphOutputCollector()); - manager.OutputSearchGraphSLF(); + manager->OutputSearchGraphSLF(); // Output search graph in hypergraph format for Kenneth Heafield's lazy hypergraph decoder - manager.OutputSearchGraphHypergraph(); + manager->OutputSearchGraphHypergraph(); additionalReportingTime.stop(); additionalReportingTime.start(); // output n-best list - manager.OutputNBest(m_ioWrapper.GetNBestOutputCollector()); + manager->OutputNBest(m_ioWrapper.GetNBestOutputCollector()); //lattice samples - manager.OutputLatticeSamples(m_ioWrapper.GetLatticeSamplesCollector()); + manager->OutputLatticeSamples(m_ioWrapper.GetLatticeSamplesCollector()); // detailed translation reporting - manager.OutputDetailedTranslationReport(m_ioWrapper.GetDetailedTranslationCollector()); + manager->OutputDetailedTranslationReport(m_ioWrapper.GetDetailedTranslationCollector()); //list of unknown words - manager.OutputUnknowns(m_ioWrapper.GetUnknownsCollector()); + manager->OutputUnknowns(m_ioWrapper.GetUnknownsCollector()); // report additional statistics - manager.CalcDecoderStatistics(); - VERBOSE(1, "Line " << m_source->GetTranslationId() << ": Additional reporting took " << additionalReportingTime << " seconds total" << endl); - VERBOSE(1, "Line " << m_source->GetTranslationId() << ": Translation took " << translationTime << " seconds total" << endl); + manager->CalcDecoderStatistics(); + VERBOSE(1, "Line " << translationId << ": Additional reporting took " << additionalReportingTime << " seconds total" << endl); + VERBOSE(1, "Line " << translationId << ": Translation took " << translationTime << " seconds total" << endl); IFVERBOSE(2) { PrintUserTime("Sentence Decoding Time:"); } + + delete manager; } |