From 93d11e36262f75b8b9efb52672aa607332b3a27f Mon Sep 17 00:00:00 2001 From: Hieu Hoang Date: Fri, 10 Oct 2014 15:09:56 +0100 Subject: merge moses_chart and moses --- moses-cmd/Main.cpp | 30 +++++++++++++++++++++++------- moses-cmd/Main.h | 5 ++--- 2 files changed, 25 insertions(+), 10 deletions(-) (limited to 'moses-cmd') diff --git a/moses-cmd/Main.cpp b/moses-cmd/Main.cpp index f7d9a44da..5758103f3 100644 --- a/moses-cmd/Main.cpp +++ b/moses-cmd/Main.cpp @@ -84,8 +84,8 @@ int main(int argc, char** argv) } // set number of significant decimals in output - fix(cout,PRECISION); - fix(cerr,PRECISION); + IOWrapper::FixPrecision(cout); + IOWrapper::FixPrecision(cerr); // load all the settings into the Parameter class // (stores them as strings, or array of strings) @@ -128,9 +128,17 @@ int main(int argc, char** argv) TRACE_ERR(weights); TRACE_ERR("\n"); } + boost::shared_ptr > hypergraphOutput; + boost::shared_ptr > hypergraphOutputChart; + if (staticData.GetOutputSearchGraphHypergraph()) { - hypergraphOutput.reset(new HypergraphOutput(PRECISION)); + if (staticData.IsChart()) { + hypergraphOutputChart.reset(new HypergraphOutput(PRECISION)); + } + else { + hypergraphOutput.reset(new HypergraphOutput(PRECISION)); + } } #ifdef WITH_THREADS @@ -149,10 +157,18 @@ int main(int argc, char** argv) FeatureFunction::CallChangeSource(source); // set up task of translating one sentence - TranslationTask* task = - new TranslationTask(source, *ioWrapper, - staticData.GetOutputSearchGraphSLF(), - hypergraphOutput); + TranslationTask* task; + if (staticData.IsChart()) { + // scfg + task = new TranslationTask(source, *ioWrapper, hypergraphOutputChart); + } + else { + // pb + task = new TranslationTask(source, *ioWrapper, + staticData.GetOutputSearchGraphSLF(), + hypergraphOutput); + } + // execute task #ifdef WITH_THREADS pool.Submit(task); diff --git a/moses-cmd/Main.h b/moses-cmd/Main.h index 362c1f245..49fee0219 100644 --- a/moses-cmd/Main.h +++ b/moses-cmd/Main.h @@ -1,3 +1,4 @@ +#pragma once // $Id$ /*********************************************************************** @@ -32,12 +33,10 @@ POSSIBILITY OF SUCH DAMAGE. // example file on how to use moses library -#ifndef moses_cmd_Main_h -#define moses_cmd_Main_h #include "moses/StaticData.h" class IOWrapper; int main(int argc, char* argv[]); -#endif + -- cgit v1.2.3