diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2014-12-29 03:31:23 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2014-12-29 03:31:23 +0300 |
commit | 5ac3dddfb6a70aee591c2902238f3ba737dbed3f (patch) | |
tree | 381001c10bb5f9dee2a3f74c2dc72ebe3e523bdd | |
parent | ec3db7bede3c55c157d2176823cb239c1ddedcca (diff) |
move OutputBestHyp() to Manager class
-rw-r--r-- | moses/IOWrapper.cpp | 13 | ||||
-rw-r--r-- | moses/IOWrapper.h | 2 | ||||
-rw-r--r-- | moses/Manager.cpp | 13 | ||||
-rw-r--r-- | moses/Manager.h | 6 | ||||
-rw-r--r-- | moses/TranslationTask.cpp | 2 |
5 files changed, 18 insertions, 18 deletions
diff --git a/moses/IOWrapper.cpp b/moses/IOWrapper.cpp index 73882f47e..1840f82ac 100644 --- a/moses/IOWrapper.cpp +++ b/moses/IOWrapper.cpp @@ -571,19 +571,6 @@ void IOWrapper::Backtrack(const Hypothesis *hypo) } } -void IOWrapper::OutputBestHypo(const std::vector<Word>& mbrBestHypo, long /*translationId*/, char /*reportSegmentation*/, bool /*reportAllFactors*/, ostream& out) -{ - - for (size_t i = 0 ; i < mbrBestHypo.size() ; i++) { - const Factor *factor = mbrBestHypo[i].GetFactor(StaticData::Instance().GetOutputFactorOrder()[0]); - UTIL_THROW_IF2(factor == NULL, - "No factor 0 at position " << i); - if (i>0) out << " " << *factor; - else out << *factor; - } - out << endl; -} - bool IOWrapper::ReadInput(InputTypeEnum inputType, InputType*& source) { delete source; diff --git a/moses/IOWrapper.h b/moses/IOWrapper.h index e0c33d910..67eaf709e 100644 --- a/moses/IOWrapper.h +++ b/moses/IOWrapper.h @@ -170,8 +170,6 @@ public: // CHART // phrase-based - void OutputBestHypo(const std::vector<Moses::Word>& mbrBestHypo, long /*translationId*/, - char reportSegmentation, bool reportAllFactors, std::ostream& out); void OutputBestHypo(const Moses::TrellisPath &path, long /*translationId*/,char reportSegmentation, bool reportAllFactors, std::ostream &out); void OutputPassthroughInformation(std::string& passthrough, const Moses::Hypothesis* hypo); diff --git a/moses/Manager.cpp b/moses/Manager.cpp index 3f0f7642a..a86a1437b 100644 --- a/moses/Manager.cpp +++ b/moses/Manager.cpp @@ -1851,4 +1851,17 @@ void Manager::OutputLatticeMBRNBest(std::ostream& out, const vector<LatticeMBRSo } } +void Manager::OutputBestHypo(const std::vector<Word>& mbrBestHypo, long /*translationId*/, char /*reportSegmentation*/, bool /*reportAllFactors*/, ostream& out) +{ + + for (size_t i = 0 ; i < mbrBestHypo.size() ; i++) { + const Factor *factor = mbrBestHypo[i].GetFactor(StaticData::Instance().GetOutputFactorOrder()[0]); + UTIL_THROW_IF2(factor == NULL, + "No factor 0 at position " << i); + if (i>0) out << " " << *factor; + else out << *factor; + } + out << endl; +} + } // namespace diff --git a/moses/Manager.h b/moses/Manager.h index fb5393d7c..9962d8e29 100644 --- a/moses/Manager.h +++ b/moses/Manager.h @@ -162,6 +162,10 @@ public: void GetWordGraph(long translationId, std::ostream &outputWordGraphStream) const; int GetNextHypoId(); + static void OutputLatticeMBRNBest(std::ostream& out, const std::vector<LatticeMBRSolution>& solutions,long translationId); + static void OutputBestHypo(const std::vector<Moses::Word>& mbrBestHypo, long /*translationId*/, + char reportSegmentation, bool reportAllFactors, std::ostream& out); + #ifdef HAVE_PROTOBUF void SerializeSearchGraphPB(long translationId, std::ostream& outputStream) const; #endif @@ -201,8 +205,6 @@ public: void OutputSearchGraphSLF() const; void OutputSearchGraphHypergraph() const; - static void OutputLatticeMBRNBest(std::ostream& out, const std::vector<LatticeMBRSolution>& solutions,long translationId); - }; } diff --git a/moses/TranslationTask.cpp b/moses/TranslationTask.cpp index 1a2d671bb..8d52789fc 100644 --- a/moses/TranslationTask.cpp +++ b/moses/TranslationTask.cpp @@ -179,7 +179,7 @@ void TranslationTask::RunPb() } else { //Lattice MBR decoding vector<Word> mbrBestHypo = doLatticeMBR(manager,nBestList); - m_ioWrapper.OutputBestHypo(mbrBestHypo, m_source->GetTranslationId(), staticData.GetReportSegmentation(), + Manager::OutputBestHypo(mbrBestHypo, m_source->GetTranslationId(), staticData.GetReportSegmentation(), staticData.GetReportAllFactors(),out); IFVERBOSE(2) { PrintUserTime("finished Lattice MBR decoding"); |