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:
authorNicola Bertoldi <bertoldi@fbk.eu>2014-06-06 02:53:36 +0400
committerNicola Bertoldi <bertoldi@fbk.eu>2014-06-06 02:53:36 +0400
commit306dc26edd6cc484682a4e28041907031e4e8bc1 (patch)
treebb401789afd14fb0c7f9e11a8cc76c4df1af4451 /moses-cmd
parented571258f7ea10bb62998ce2ef58006f3bdd9771 (diff)
the management of passthrough xml-tags is introduced
Diffstat (limited to 'moses-cmd')
-rw-r--r--moses-cmd/IOWrapper.cpp14
-rw-r--r--moses-cmd/IOWrapper.h1
-rw-r--r--moses-cmd/Main.cpp3
3 files changed, 18 insertions, 0 deletions
diff --git a/moses-cmd/IOWrapper.cpp b/moses-cmd/IOWrapper.cpp
index de94fde3a..f9362575f 100644
--- a/moses-cmd/IOWrapper.cpp
+++ b/moses-cmd/IOWrapper.cpp
@@ -294,6 +294,12 @@ void OutputSurface(std::ostream &out, const Hypothesis &edge, const std::vector<
}
}
+void OutputPassthroughInformation(std::ostream &out, const Hypothesis *hypo)
+{
+ std::string passthrough = hypo->GetManager().GetSource().GetPassthroughInformation();
+ out << passthrough;
+}
+
void OutputBestSurface(std::ostream &out, const Hypothesis *hypo, const std::vector<FactorType> &outputFactorOrder,
char reportSegmentation, bool reportAllFactors)
{
@@ -431,6 +437,10 @@ void IOWrapper::OutputBestHypo(const Hypothesis *hypo, long /*translationId*/, c
if (hypo != NULL) {
VERBOSE(1,"BEST TRANSLATION: " << *hypo << endl);
VERBOSE(3,"Best path: ");
+ if (StaticData::Instance().IsPassthroughEnabled())
+ {
+ OutputPassthroughInformation(cout, hypo);
+ }
Backtrack(hypo);
VERBOSE(3,"0" << std::endl);
if (!m_surpressSingleBestOutput) {
@@ -471,6 +481,10 @@ void OutputNBest(std::ostream& out
// print the surface factor of the translation
out << translationId << " ||| ";
+ if (staticData.IsPassthroughInNBestEnabled())
+ {
+ OutputPassthroughInformation(out, edges[edges.size() - 1]);
+ }
for (int currEdge = (int)edges.size() - 1 ; currEdge >= 0 ; currEdge--) {
const Hypothesis &edge = *edges[currEdge];
OutputSurface(out, edge, outputFactorOrder, reportSegmentation, reportAllFactors);
diff --git a/moses-cmd/IOWrapper.h b/moses-cmd/IOWrapper.h
index 93539ce0b..0db87051e 100644
--- a/moses-cmd/IOWrapper.h
+++ b/moses-cmd/IOWrapper.h
@@ -139,6 +139,7 @@ void OutputBestHypo(const std::vector<Moses::Word>& mbrBestHypo, long /*transla
char reportSegmentation, bool reportAllFactors, std::ostream& out);
void OutputBestHypo(const Moses::TrellisPath &path, long /*translationId*/,char reportSegmentation, bool reportAllFactors, std::ostream &out);
void OutputInput(std::ostream& os, const Moses::Hypothesis* hypo);
+void OutputPassthroughInformation(std::ostream& os, const Moses::Hypothesis* hypo);
void OutputAlignment(Moses::OutputCollector* collector, size_t lineNo, const Moses::Hypothesis *hypo);
void OutputAlignment(Moses::OutputCollector* collector, size_t lineNo, const Moses::TrellisPath &path);
void OutputAlignment(std::ostream &out, const Moses::Hypothesis *hypo);
diff --git a/moses-cmd/Main.cpp b/moses-cmd/Main.cpp
index f77dc2373..115e8b3fa 100644
--- a/moses-cmd/Main.cpp
+++ b/moses-cmd/Main.cpp
@@ -316,6 +316,9 @@ public:
if (staticData.GetParam("print-id").size() && Scan<bool>(staticData.GetParam("print-id")[0]) ) {
out << m_source->GetTranslationId() << " ";
}
+ if (staticData.IsPassthroughEnabled()) {
+ OutputPassthroughInformation(out, bestHypo);
+ }
if (staticData.GetReportSegmentation() == 2) {
manager.GetOutputLanguageModelOrder(out, bestHypo);