summaryrefslogtreecommitdiff
path: root/decoder
diff options
context:
space:
mode:
authorPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-06-13 14:42:07 +0200
committerPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-06-13 14:42:07 +0200
commite6d3c25191873ca0cf99db8e89702ed91d65277c (patch)
treeb0697ece6f5e4a8229915758c68750793a23f776 /decoder
parent62c805c90c5347b844f92574e240db5c65578e12 (diff)
parent3acdf1e4b37637d6df86a7b54fb0f1b0464c172b (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'decoder')
-rw-r--r--decoder/decoder.cc19
-rw-r--r--decoder/ff_klm.cc7
-rw-r--r--decoder/hg.cc5
3 files changed, 20 insertions, 11 deletions
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<FeatureFunction> make_ff(string const& ffp,bool verbose_feature_functions,char const* pre="") {
string ff, param;
SplitCommandAndParam(ffp, &ff, &param);
- 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<FeatureFunction> 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 "<<nbyte<<" bytes for "<<pre<<"feature "<<ffp<<endl;
return pf;
}
@@ -142,7 +145,7 @@ inline boost::shared_ptr<FsaFeatureFunction> make_fsa_ff(string const& ffp,bool
else cerr << " (no config parameters)\n";
boost::shared_ptr<FsaFeatureFunction> pf = fsa_ff_registry.Create(ff, param);
if (!pf) exit(1);
- if (verbose_feature_functions)
+ if (verbose_feature_functions && !SILENT)
cerr<<"State is "<<pf->state_bytes()<<" bytes for "<<pre<<"feature "<<ffp<<endl;
return pf;
}
@@ -211,8 +214,10 @@ struct DecoderImpl {
}
forest.PruneInsideOutside(beam_prune,density_prune,pm,false,1);
if (!forestname.empty()) forestname=" "+forestname;
- forest_stats(forest," Pruned "+forestname+" forest",false,false);
- cerr << " Pruned "<<forestname<<" forest portion of edges kept: "<<forest.edges_.size()/presize<<endl;
+ if (!SILENT) {
+ forest_stats(forest," Pruned "+forestname+" forest",false,false);
+ cerr << " Pruned "<<forestname<<" forest portion of edges kept: "<<forest.edges_.size()/presize<<endl;
+ }
}
}
diff --git a/decoder/ff_klm.cc b/decoder/ff_klm.cc
index 7a84add7..09ef282c 100644
--- a/decoder/ff_klm.cc
+++ b/decoder/ff_klm.cc
@@ -11,6 +11,7 @@
#include "tdict.h"
#include "lm/model.hh"
#include "lm/enumerate_vocab.hh"
+#include "utils/verbose.h"
#include "lm/left.hh"
@@ -232,7 +233,8 @@ class KLanguageModelImpl {
ngram_ = new Model(filename.c_str(), conf);
}
order_ = ngram_->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<WordID> dummy;
int lc = 0;
- cerr << " Loading word classes from " << file << " ...\n";
+ if (!SILENT)
+ cerr << " Loading word classes from " << file << " ...\n";
AddWordToClassMapping_(TD::Convert("<s>"), TD::Convert("<s>"));
AddWordToClassMapping_(TD::Convert("</s>"), TD::Convert("</s>"));
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<WordID> bp;
rnum = min(rnum, static_cast<unsigned>(density * plen));
- cerr << "Density pruning: keep "<<rnum<<" of "<<edges_.size()<<" edges (viterbi = "<<plen<<" edges)"<<endl;
+ if (!SILENT) cerr << "Density pruning: keep "<<rnum<<" of "<<edges_.size()<<" edges (viterbi = "<<plen<<" edges)"<<endl;
if (rnum == edges_.size()) {
- cerr << "No pruning required: denisty already sufficient\n";
+ if (!SILENT) cerr << "No pruning required: denisty already sufficient\n";
if (!use_beam)
return false;
use_density=false;