From 0277e5da3aa444ced74af8085f3349f91d17e56f Mon Sep 17 00:00:00 2001 From: redpony Date: Tue, 21 Sep 2010 20:10:27 +0000 Subject: fix for lattice cost bug git-svn-id: https://ws10smt.googlecode.com/svn/trunk@653 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/bottom_up_parser.cc | 2 +- decoder/decoder.cc | 6 +++--- decoder/rule_lexer.l | 7 +++++-- decoder/scfg_translator.cc | 6 +++--- 4 files changed, 12 insertions(+), 9 deletions(-) (limited to 'decoder') diff --git a/decoder/bottom_up_parser.cc b/decoder/bottom_up_parser.cc index 2d945222..9504419c 100644 --- a/decoder/bottom_up_parser.cc +++ b/decoder/bottom_up_parser.cc @@ -188,7 +188,7 @@ void PassiveChart::ApplyRule(const int i, new_edge->i_ = i; new_edge->j_ = j; new_edge->feature_values_ = r->GetFeatureValues(); - if (lattice_cost) + if (lattice_cost && lc_fid_) new_edge->feature_values_.set_value(lc_fid_, lattice_cost); Cat2NodeMap& c2n = nodemap_(i,j); const bool is_goal = (r->GetLHS() == kGOAL); diff --git a/decoder/decoder.cc b/decoder/decoder.cc index e0967e40..1a233fc5 100644 --- a/decoder/decoder.cc +++ b/decoder/decoder.cc @@ -580,10 +580,10 @@ DecoderImpl::DecoderImpl(po::variables_map& conf, int argc, char** argv, istream cerr << "prelm rescoring with "<AsString() << std::endl; num_rules++; lex_line++; - if (num_rules % 50000 == 0) { std::cerr << '.' << std::flush; fl = true; } - if (num_rules % 2000000 == 0) { std::cerr << " [" << num_rules << "]\n"; fl = false; } + if (!SILENT) { + if (num_rules % 50000 == 0) { std::cerr << '.' << std::flush; fl = true; } + if (num_rules % 2000000 == 0) { std::cerr << " [" << num_rules << "]\n"; fl = false; } + } ctf_level = 0; BEGIN(INITIAL); } diff --git a/decoder/scfg_translator.cc b/decoder/scfg_translator.cc index 4e6cc226..60123e6f 100644 --- a/decoder/scfg_translator.cc +++ b/decoder/scfg_translator.cc @@ -34,7 +34,7 @@ struct SCFGTranslatorImpl { if(conf.count("grammar")){ vector gfiles = conf["grammar"].as >(); for (int i = 0; i < gfiles.size(); ++i) { - cerr << "Reading SCFG grammar from " << gfiles[i] << endl; + if (!SILENT) cerr << "Reading SCFG grammar from " << gfiles[i] << endl; TextGrammar* g = new TextGrammar(gfiles[i]); g->SetMaxSpan(max_span_limit); g->SetGrammarName(gfiles[i]); @@ -46,7 +46,7 @@ struct SCFGTranslatorImpl { GlueGrammar* g = new GlueGrammar(conf["scfg_extra_glue_grammar"].as()); g->SetGrammarName("ExtraGlueGrammar"); grammars.push_back(GrammarPtr(g)); - cerr << "Adding glue grammar from file " << conf["scfg_extra_glue_grammar"].as() << endl; + if (!SILENT) cerr << "Adding glue grammar from file " << conf["scfg_extra_glue_grammar"].as() << endl; } ctf_iterations_=0; if (use_ctf_){ @@ -74,7 +74,7 @@ struct SCFGTranslatorImpl { GlueGrammar* g = new GlueGrammar(goal, default_nt, ctf_iterations_); g->SetGrammarName("GlueGrammar"); grammars.push_back(GrammarPtr(g)); - cerr << "Adding glue grammar for default nonterminal " << default_nt << + if (!SILENT) cerr << "Adding glue grammar for default nonterminal " << default_nt << " and goal nonterminal " << goal << endl; } } -- cgit v1.2.3