diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2014-12-04 18:28:50 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2014-12-04 18:28:50 +0300 |
commit | d5e315a599196f40229ab05cd5ab49fbd8ec100d (patch) | |
tree | cab1a3007cf73db8925c5071f6cbca8f7bafa1f0 | |
parent | 80eada0640dc3590a347851da0366636f6701742 (diff) |
move OutputDetailedTranslationReport() into Syntax::Manager
-rw-r--r-- | moses/Syntax/S2T/Manager-inl.h | 14 | ||||
-rw-r--r-- | moses/TranslationTask.h | 7 |
2 files changed, 15 insertions, 6 deletions
diff --git a/moses/Syntax/S2T/Manager-inl.h b/moses/Syntax/S2T/Manager-inl.h index 3e0a58840..06474b423 100644 --- a/moses/Syntax/S2T/Manager-inl.h +++ b/moses/Syntax/S2T/Manager-inl.h @@ -14,6 +14,7 @@ #include "moses/Syntax/SVertexRecombinationOrderer.h" #include "moses/Syntax/SymbolEqualityPred.h" #include "moses/Syntax/SymbolHasher.h" +#include "DerivationWriter.h" #include "OovHandler.h" #include "PChart.h" @@ -409,7 +410,18 @@ void Manager<Parser>::OutputAlignment(OutputCollector *collector) const template<typename Parser> void Manager<Parser>::OutputDetailedTranslationReport(OutputCollector *collector) const -{} +{ + const SHyperedge *best = GetBestSHyperedge(); + if (best == NULL || collector == NULL) { + return; + } + + long translationId = m_source.GetTranslationId(); + std::ostringstream out; + Syntax::S2T::DerivationWriter::Write(*best, translationId, out); + collector->Write(translationId, out.str()); + +} template<typename Parser> void Manager<Parser>::OutputNBestList(OutputCollector *collector, diff --git a/moses/TranslationTask.h b/moses/TranslationTask.h index 674616891..fde846619 100644 --- a/moses/TranslationTask.h +++ b/moses/TranslationTask.h @@ -67,11 +67,8 @@ private: // Write 1-best derivation (-translation-details / -T option). - /* - if (staticData.IsDetailedTranslationReportingEnabled()) { - m_ioWrapper.OutputDetailedTranslationReport(best, translationId); - } - */ + manager.OutputDetailedTranslationReport(m_ioWrapper.GetDetailedTranslationCollector()); + // Write unknown words file (-output-unknowns option) if (!staticData.GetOutputUnknownsFile().empty()) { m_ioWrapper.OutputUnknowns(manager.GetUnknownWords(), translationId); |