From 17c8e9a7ef19fbd3158efc6fd40313ce7ca5273f Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Tue, 1 Apr 2014 00:53:00 -0400 Subject: tree2string test, fix for edge case --- decoder/tree2string_translator.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'decoder') 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 prune(hg.edges_.size(), false); + hg.PruneEdges(prune, true); + //hg.PrintGraphviz(); minus_lm_forest->swap(hg); return true; -- cgit v1.2.3