diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-10 02:29:56 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-10 02:29:56 +0000 |
commit | ac58a78e4c2c129c838927b1479c31788fd9bd5f (patch) | |
tree | c74908f34d681995ea53faa138219a95fe3674f7 /decoder/cfg.cc | |
parent | ae6e9133a743e824fb2671505d5dcaa6469f887e (diff) |
parse trule(string) using lexer - needs testing, affects earley_composer
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@497 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/cfg.cc')
-rwxr-xr-x | decoder/cfg.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/decoder/cfg.cc b/decoder/cfg.cc index 0f20ba0f..b83fc54d 100755 --- a/decoder/cfg.cc +++ b/decoder/cfg.cc @@ -1,5 +1,6 @@ #include "cfg.h" #include "hg.h" +#include "cfg_format.h" using namespace std; @@ -10,6 +11,7 @@ void CFG::Init(Hypergraph const& hg,bool target_side,bool copy_features,bool pus pushed_inside=push_weights ? goal_inside : prob_t(1); int nn=hg.nodes_.size(),ne=hg.edges_.size(); nts.resize(nn); + goal_nt=nn-1; rules.resize(ne); for (int i=0;i<nn;++i) nts[i].ruleids=hg.nodes_[i].in_edges_; @@ -40,3 +42,13 @@ void CFG::Init(Hypergraph const& hg,bool target_side,bool copy_features,bool pus } } } + +namespace { +} + +void CFG::Print(std::ostream &o,CFGFormat const& f) const { + char const* partsep=" ||| "; + if (!f.goal_nt_name.empty()) + o << '['<<f.goal_nt_name <<']' << partsep; // print rhs + //TODO: +} |