diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-11 01:08:50 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-11 01:08:50 +0000 |
commit | b5bd75ab4a66e61e724fcb9488d164a3936a6b4e (patch) | |
tree | a2f0bf8c8ade27e598404e40d423f094665be7bc /decoder/trule.cc | |
parent | 88827bde7abd9745fb0437a299e0bb6ad96babe6 (diff) |
cout<<TRule
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@506 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/trule.cc')
-rw-r--r-- | decoder/trule.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/decoder/trule.cc b/decoder/trule.cc index f43fbb58..b9494951 100644 --- a/decoder/trule.cc +++ b/decoder/trule.cc @@ -9,6 +9,10 @@ using namespace std; +ostream &operator<<(ostream &o,TRule const& r) { + o<<r.AsString(true); +} + bool TRule::IsGoal() const { static const int kGOAL(TD::Convert("Goal") * -1); // this will happen once, and after static init of trule.cc static dict. return GetLHS() == kGOAL; @@ -65,7 +69,7 @@ static WordID ConvertLHS(const string& w) { } } -TRule* TRule::CreateRuleSynchronous(const std::string& rule) { +TRule* TRule::CreateRuleSynchronous(const string& rule) { TRule* res = new TRule; if (res->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 "<<line<<".\n"; + cerr<<"\nWARNING: building rule from multi-line string "<<line<<".\n"; // backed off of this: it's failing to parse TRulePtr glue(new TRule("[" + goal_nt + "] ||| [" + goal_nt + ",1] ["+ default_nt + ",2] ||| [1] [2] ||| Glue=1")); thinks [1] is the features! if (false && !(mono||strict)) { // use lexer @@ -114,7 +118,7 @@ bool TRule::ReadFromString(const string& line, bool strict, bool mono) { n_assigned=0; RuleLexer::ReadRules(&il,assign_trule,this); if (n_assigned>1) - std::cerr<<"\nWARNING: more than one rule parsed from multi-line string; kept last: "<<line<<".\n"; + cerr<<"\nWARNING: more than one rule parsed from multi-line string; kept last: "<<line<<".\n"; return n_assigned; } |