summaryrefslogtreecommitdiff
path: root/decoder/cfg.cc
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-10 02:29:56 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-10 02:29:56 +0000
commit52c656a62d05135cf6ffd80249d5a44a07a40816 (patch)
tree7f9c7b0862dc02f2a0b3fbe2c6d6d4c3da9322f7 /decoder/cfg.cc
parent4f99f17541c1fe104afbcf04e3d8d04ad9f1227a (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-xdecoder/cfg.cc12
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:
+}