From 851e389dffdd6996ea32d70defb8906de80b9edc Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Mon, 14 Dec 2009 20:35:11 -0500 Subject: few small fixes of alignment tools, add new orthographic similarity feature for word aligner, final naming of directories, libraries in cdec --- decoder/forest_writer.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 decoder/forest_writer.cc (limited to 'decoder/forest_writer.cc') diff --git a/decoder/forest_writer.cc b/decoder/forest_writer.cc new file mode 100644 index 00000000..a9117d18 --- /dev/null +++ b/decoder/forest_writer.cc @@ -0,0 +1,23 @@ +#include "forest_writer.h" + +#include + +#include + +#include "filelib.h" +#include "hg_io.h" +#include "hg.h" + +using namespace std; + +ForestWriter::ForestWriter(const std::string& path, int num) : + fname_(path + '/' + boost::lexical_cast(num) + ".json.gz"), used_(false) {} + +bool ForestWriter::Write(const Hypergraph& forest, bool minimal_rules) { + assert(!used_); + used_ = true; + cerr << " Writing forest to " << fname_ << endl; + WriteFile wf(fname_); + return HypergraphIO::WriteToJSON(forest, minimal_rules, wf.stream()); +} + -- cgit v1.2.3