summaryrefslogtreecommitdiff
path: root/decoder
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
commitc11c7af0746edbceec5ad49e2e8efeb34bceaa6b (patch)
tree8be2063e6d48f80b06d54b4f9de60e5a88375406 /decoder
parent8bf3c1bef16c2c25289d51b48cb0cf3fcff45e60 (diff)
remove fixed bug warning
Diffstat (limited to 'decoder')
-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) {