From f5cc1e175e11a59ec1297d4d823f0d59820bf346 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Fri, 9 May 2014 00:01:40 -0400 Subject: remove fixed bug warning --- decoder/tree2string_translator.cc | 8 ++++---- 1 file 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 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 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) { -- cgit v1.2.3