From b5bd75ab4a66e61e724fcb9488d164a3936a6b4e Mon Sep 17 00:00:00 2001 From: graehl Date: Wed, 11 Aug 2010 01:08:50 +0000 Subject: cout< const& rule_rhs=target_side?er.e():er.f(); RHS &rhs=cfgr.rhs; - int nr=rule_rhs.size(); - rhs.resize(nr); prob_t &crp=cfgr.p; crp=e.edge_prob_; cfgr.lhs=e.head_node_; @@ -46,6 +44,8 @@ void CFG::Init(Hypergraph const& hg,bool target_side,bool copy_features,bool pus #endif if (copy_features) cfgr.f=e.feature_values_; if (push_weights) crp /=np[e.head_node_]; + int nr=rule_rhs.size(); + rhs.resize(nr); for (int j=0;j0) @@ -71,6 +71,9 @@ void CFG::PrintRule(std::ostream &o,RuleHandle rulei,CFGFormat const& f) const { f.print_lhs(o,*this,r.lhs); f.print_rhs(o,*this,r.rhs.begin(),r.rhs.end()); f.print_features(o,r.p,r.f); +#if CFG_DEBUG + o<ReadFromString(rule, true, false)) return res; cerr << "[ERROR] Failed to creating rule from: " << rule << endl; @@ -106,7 +110,7 @@ void assign_trule(const TRulePtr& new_rule, const unsigned int ctf_level, const bool TRule::ReadFromString(const string& line, bool strict, bool mono) { if (!is_single_line_stripped(line)) - std::cerr<<"\nWARNING: building rule from multi-line string "<1) - std::cerr<<"\nWARNING: more than one rule parsed from multi-line string; kept last: "<