From 800a644202f33a4ecd0672c2a5fc33d740367b15 Mon Sep 17 00:00:00 2001 From: Victor Chahuneau Date: Mon, 4 Jun 2012 02:10:08 -0400 Subject: Make decoder REALLY quiet when SILENT=1 --- decoder/decoder.cc | 19 ++++++++++++------- decoder/ff_klm.cc | 7 +++++-- decoder/hg.cc | 5 +++-- 3 files changed, 20 insertions(+), 11 deletions(-) (limited to 'decoder') diff --git a/decoder/decoder.cc b/decoder/decoder.cc index 487c7635..cbb97a0d 100644 --- a/decoder/decoder.cc +++ b/decoder/decoder.cc @@ -122,13 +122,16 @@ inline bool store_conf(po::variables_map const& conf,std::string const& name,V * inline boost::shared_ptr make_ff(string const& ffp,bool verbose_feature_functions,char const* pre="") { string ff, param; SplitCommandAndParam(ffp, &ff, ¶m); - cerr << pre << "feature: " << ff; - if (param.size() > 0) cerr << " (with config parameters '" << param << "')\n"; - else cerr << " (no config parameters)\n"; + if (verbose_feature_functions && !SILENT) + cerr << pre << "feature: " << ff; + if (!SILENT) { + if (param.size() > 0) cerr << " (with config parameters '" << param << "')\n"; + else cerr << " (no config parameters)\n"; + } boost::shared_ptr pf = ff_registry.Create(ff, param); if (!pf) exit(1); int nbyte=pf->NumBytesContext(); - if (verbose_feature_functions) + if (verbose_feature_functions && !SILENT) cerr<<"State is "< make_fsa_ff(string const& ffp,bool else cerr << " (no config parameters)\n"; boost::shared_ptr pf = fsa_ff_registry.Create(ff, param); if (!pf) exit(1); - if (verbose_feature_functions) + if (verbose_feature_functions && !SILENT) cerr<<"State is "<state_bytes()<<" bytes for "<Order(); - cerr << "Loaded " << order_ << "-gram KLM from " << filename << " (MapSize=" << cdec2klm_map_.size() << ")\n"; + if (!SILENT) + cerr << "Loaded " << order_ << "-gram KLM from " << filename << " (MapSize=" << cdec2klm_map_.size() << ")\n"; // special handling of beginning / ending sentence markers kSOS_ = MapWord(kCDEC_SOS); @@ -252,7 +254,8 @@ class KLanguageModelImpl { string line; vector dummy; int lc = 0; - cerr << " Loading word classes from " << file << " ...\n"; + if (!SILENT) + cerr << " Loading word classes from " << file << " ...\n"; AddWordToClassMapping_(TD::Convert(""), TD::Convert("")); AddWordToClassMapping_(TD::Convert(""), TD::Convert("")); while(in) { diff --git a/decoder/hg.cc b/decoder/hg.cc index 0dcbe91f..dd272221 100644 --- a/decoder/hg.cc +++ b/decoder/hg.cc @@ -13,6 +13,7 @@ #include "viterbi.h" #include "inside_outside.h" #include "tdict.h" +#include "verbose.h" using namespace std; @@ -330,9 +331,9 @@ bool Hypergraph::PruneInsideOutside(double alpha,double density,const EdgeMask* const int plen = ViterbiPathLength(*this); vector bp; rnum = min(rnum, static_cast(density * plen)); - cerr << "Density pruning: keep "<