summaryrefslogtreecommitdiff
path: root/decoder/tree2string_translator.cc
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2014-04-01 00:53:00 -0400
committerChris Dyer <redpony@gmail.com>2014-04-01 00:53:00 -0400
commit6a3e80bb4b2a6bb10899183299d14fc070db1654 (patch)
tree22e4345f2dc67dd0fd4637e92d205ce59a90d3b3 /decoder/tree2string_translator.cc
parent2999e2b3eac185bf3d0d3887576e94d3c11c9b46 (diff)
tree2string test, fix for edge case
Diffstat (limited to 'decoder/tree2string_translator.cc')
-rw-r--r--decoder/tree2string_translator.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/decoder/tree2string_translator.cc b/decoder/tree2string_translator.cc
index 09eca147..7bc49132 100644
--- a/decoder/tree2string_translator.cc
+++ b/decoder/tree2string_translator.cc
@@ -167,6 +167,12 @@ struct Tree2StringTranslatorImpl {
//cerr << "Goal node: " << goal << endl;
hg.TopologicallySortNodesAndEdges(goal);
hg.Reweight(weights);
+
+ // there might be nodes that cannot be derived
+ // the following takes care of them
+ vector<bool> prune(hg.edges_.size(), false);
+ hg.PruneEdges(prune, true);
+
//hg.PrintGraphviz();
minus_lm_forest->swap(hg);
return true;