Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2014-12-30 18:06:59 +0300
committerHieu Hoang <hieuhoang@gmail.com>2014-12-30 18:06:59 +0300
commitc9d49f22a5016e8262cf6a780a07f5c6f50a344b (patch)
tree243590b68076e47d4ca4caf47437db74b4021f4d
parente92c2c0e0c045763a062b2956c900819f8484af0 (diff)
move OutputAlignment() to Manager class
-rw-r--r--moses/IOWrapper.cpp15
-rw-r--r--moses/IOWrapper.h2
-rw-r--r--moses/Manager.cpp15
-rw-r--r--moses/Manager.h3
-rw-r--r--moses/TranslationTask.cpp4
5 files changed, 20 insertions, 19 deletions
diff --git a/moses/IOWrapper.cpp b/moses/IOWrapper.cpp
index a5a2e1fdb..e69bb3542 100644
--- a/moses/IOWrapper.cpp
+++ b/moses/IOWrapper.cpp
@@ -391,21 +391,6 @@ void IOWrapper::WriteApplicationContext(std::ostream &out,
}
}
-void IOWrapper::OutputAlignment(OutputCollector* collector, size_t lineNo , const vector<const Hypothesis *> &edges)
-{
- ostringstream out;
- Hypothesis::OutputAlignment(out, edges);
-
- collector->Write(lineNo,out.str());
-}
-
-void IOWrapper::OutputAlignment(OutputCollector* collector, size_t lineNo , const TrellisPath &path)
-{
- if (collector) {
- OutputAlignment(collector,lineNo, path.GetEdges());
- }
-}
-
void IOWrapper::Backtrack(const Hypothesis *hypo)
{
diff --git a/moses/IOWrapper.h b/moses/IOWrapper.h
index 445b87bb0..8fcc2feff 100644
--- a/moses/IOWrapper.h
+++ b/moses/IOWrapper.h
@@ -166,8 +166,6 @@ public:
// CHART
// phrase-based
- void OutputAlignment(Moses::OutputCollector* collector, size_t lineNo, const Moses::TrellisPath &path);
- void OutputAlignment(OutputCollector* collector, size_t lineNo , const std::vector<const Hypothesis *> &edges);
// post editing
std::ifstream *spe_src, *spe_trg, *spe_aln;
diff --git a/moses/Manager.cpp b/moses/Manager.cpp
index 755547c34..44a1796ce 100644
--- a/moses/Manager.cpp
+++ b/moses/Manager.cpp
@@ -1875,4 +1875,19 @@ void Manager::OutputBestHypo(const Moses::TrellisPath &path, long /*translationI
out << endl;
}
+void Manager::OutputAlignment(OutputCollector* collector, size_t lineNo , const vector<const Hypothesis *> &edges)
+{
+ ostringstream out;
+ Hypothesis::OutputAlignment(out, edges);
+
+ collector->Write(lineNo,out.str());
+}
+
+void Manager::OutputAlignment(OutputCollector* collector, size_t lineNo , const TrellisPath &path)
+{
+ if (collector) {
+ OutputAlignment(collector,lineNo, path.GetEdges());
+ }
+}
+
} // namespace
diff --git a/moses/Manager.h b/moses/Manager.h
index eb0ca5258..1c8c25fe3 100644
--- a/moses/Manager.h
+++ b/moses/Manager.h
@@ -167,6 +167,9 @@ public:
char reportSegmentation, bool reportAllFactors, std::ostream& out) const;
void OutputBestHypo(const Moses::TrellisPath &path, long /*translationId*/,char reportSegmentation, bool reportAllFactors, std::ostream &out) const;
+ void OutputAlignment(Moses::OutputCollector* collector, size_t lineNo, const Moses::TrellisPath &path);
+ void OutputAlignment(OutputCollector* collector, size_t lineNo , const std::vector<const Hypothesis *> &edges);
+
#ifdef HAVE_PROTOBUF
void SerializeSearchGraphPB(long translationId, std::ostream& outputStream) const;
#endif
diff --git a/moses/TranslationTask.cpp b/moses/TranslationTask.cpp
index 5aafca2d0..636083c1e 100644
--- a/moses/TranslationTask.cpp
+++ b/moses/TranslationTask.cpp
@@ -193,7 +193,7 @@ void TranslationTask::RunPb()
manager.OutputBestHypo(conBestHypo, m_source->GetTranslationId(),
staticData.GetReportSegmentation(),
staticData.GetReportAllFactors(),out);
- m_ioWrapper.OutputAlignment(m_ioWrapper.GetAlignmentInfoCollector(), m_source->GetTranslationId(), conBestHypo);
+ manager.OutputAlignment(m_ioWrapper.GetAlignmentInfoCollector(), m_source->GetTranslationId(), conBestHypo);
IFVERBOSE(2) {
PrintUserTime("finished Consensus decoding");
}
@@ -205,7 +205,7 @@ void TranslationTask::RunPb()
manager.OutputBestHypo(mbrBestHypo, m_source->GetTranslationId(),
staticData.GetReportSegmentation(),
staticData.GetReportAllFactors(),out);
- m_ioWrapper.OutputAlignment(m_ioWrapper.GetAlignmentInfoCollector(), m_source->GetTranslationId(), mbrBestHypo);
+ manager.OutputAlignment(m_ioWrapper.GetAlignmentInfoCollector(), m_source->GetTranslationId(), mbrBestHypo);
IFVERBOSE(2) {
PrintUserTime("finished MBR decoding");
}