summaryrefslogtreecommitdiff
path: root/decoder/tree2string_translator.cc
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2014-05-09 00:01:40 -0400
committerChris Dyer <redpony@gmail.com>2014-05-09 00:01:40 -0400
commitf5cc1e175e11a59ec1297d4d823f0d59820bf346 (patch)
tree58cb9861176013de6a3e76b625b8021e66238c6e /decoder/tree2string_translator.cc
parent57d87fb8aa4bdda78b02afbf43b332d662e802f4 (diff)
remove fixed bug warning
Diffstat (limited to 'decoder/tree2string_translator.cc')
-rw-r--r--decoder/tree2string_translator.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/decoder/tree2string_translator.cc b/decoder/tree2string_translator.cc
index 38daeeb5..5d7aa5e2 100644
--- a/decoder/tree2string_translator.cc
+++ b/decoder/tree2string_translator.cc
@@ -21,6 +21,8 @@ struct Tree2StringGrammarNode {
vector<TRulePtr> rules;
};
+// this needs to be rewritten so it is fast and checks errors well
+// use a lexer probably
void ReadTree2StringGrammar(istream* in, Tree2StringGrammarNode* root) {
string line;
while(getline(*in, line)) {
@@ -36,10 +38,8 @@ void ReadTree2StringGrammar(istream* in, Tree2StringGrammarNode* root) {
ostringstream os;
int lhs = -(rule_src.root & cdec::ALL_MASK);
// build source RHS for SCFG projection
- // TODO - this is buggy - it will generate a well-formed SCFG rule
- // so it will not generate source strings correctly
- // it will, however, generate target translations appropriately
vector<int> frhs;
+ // we traverse the rule_src in left to right, DFS order
for (auto sym : rule_src) {
//cerr << TD::Convert(sym & cdec::ALL_MASK) << endl;
cur = &cur->next[sym];
@@ -48,7 +48,7 @@ void ReadTree2StringGrammar(istream* in, Tree2StringGrammarNode* root) {
frhs.push_back(-nt);
} else if (cdec::IsTerminal(sym)) {
frhs.push_back(sym);
- }
+ } // else internal NT, nothing to do
}
os << '[' << TD::Convert(-lhs) << "] |||";
for (auto x : frhs) {