diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2012-07-29 21:04:14 -0400 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2012-07-29 21:04:14 -0400 |
commit | bd897e664a7ca51caa3cd76e444466cc410ac354 (patch) | |
tree | c6e2500d781635f6393c5c66b94e4584136e1de0 /decoder/hg_io.cc | |
parent | a9a52d22b824ccec7104036fc746d9cc30155681 (diff) |
fix grammar converter to remove edges that cannot exist in any valid derivation
Diffstat (limited to 'decoder/hg_io.cc')
-rw-r--r-- | decoder/hg_io.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/decoder/hg_io.cc b/decoder/hg_io.cc index bfb2fb80..8bd40387 100644 --- a/decoder/hg_io.cc +++ b/decoder/hg_io.cc @@ -261,6 +261,7 @@ static void WriteRule(const TRule& r, ostream* out) { } bool HypergraphIO::WriteToJSON(const Hypergraph& hg, bool remove_rules, ostream* out) { + if (hg.empty()) { *out << "{}\n"; return true; } map<const TRule*, int> rid; ostream& o = *out; rid[NULL] = 0; |