diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-11 03:02:38 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-11 03:02:38 +0000 |
commit | 5b6a409e0818529ca4ac1c080bd091437eae2911 (patch) | |
tree | 26fd6f4fb8ed02b358ee7e757b7a30467316bf3f /decoder/cfg.cc | |
parent | fd5351477569ab0db63b38aa2a2da3bbb2b2a1a6 (diff) |
cfg binarization compiles
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@515 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/cfg.cc')
-rwxr-xr-x | decoder/cfg.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/decoder/cfg.cc b/decoder/cfg.cc index 74e23cb6..4149a1ce 100755 --- a/decoder/cfg.cc +++ b/decoder/cfg.cc @@ -10,9 +10,10 @@ using namespace std; namespace { -BinRhs nullrhs(std::numeric_limits<int>::min(),std::numeric_limits<int>::min()); +CFG::BinRhs nullrhs(std::numeric_limits<int>::min(),std::numeric_limits<int>::min()); } -WordID CFG::BinName(BinRhs const& b); + +WordID CFG::BinName(BinRhs const& b) { return TD::Convert(lexical_cast<string>(b.first)+"+"+lexical_cast<string>(b.second)); } @@ -37,8 +38,8 @@ void CFG::Binarize(CFGBinarize const& b) { BinRhs bin; for (NTs::const_iterator n=nts.begin(),nn=nts.end();n!=nn;++n) { NT const& nt=*n; - for (Ruleids::iterator ir=n.ruleids.begin(),er=n.ruleids.end();ir!=er;++ir) { - RHS &rhs=ir->rhs; // we're going to binarize this while adding newly created rules to new_... + for (Ruleids::const_iterator ir=nt.ruleids.begin(),er=nt.ruleids.end();ir!=er;++ir) { + RHS &rhs=rules[*ir].rhs; // we're going to binarize this while adding newly created rules to new_... if (rhs.empty()) continue; bin.second=rhs.back(); for (int r=rhs.size()-2;r>=rhsmin;--r) { // pairs from right to left (normally we leave the last pair alone) @@ -55,8 +56,8 @@ void CFG::Binarize(CFGBinarize const& b) { } } } - batch_append_swap(nts,new_nts); - batch_append_swap(rules,new_rules); + batched_append_swap(nts,new_nts); + batched_append_swap(rules,new_rules); } namespace { |