#ifndef CFG_OPTIONS_H #define CFG_OPTIONS_H #include "hg_cfg.h" #include "cfg_format.h" #include "cfg_binarize.h" //#include "program_options.h" struct CFGOptions { CFGFormat format; CFGBinarize binarize; std::string out,source_out,unbin_out; bool uniq; void set_defaults() { format.set_defaults(); binarize.set_defaults(); out=source_out=unbin_out=""; uniq=false; } CFGOptions() { set_defaults(); } template // template to support both printable_opts and boost nonprintable void AddOptions(Opts *opts) { opts->add_options() ("cfg_output", defaulted_value(&out),"write final target CFG (before FSA rescoring) to this file") ("source_cfg_output", defaulted_value(&source_out),"write source CFG (after prelm-scoring, prelm-prune) to this file") ("cfg_unbin_output", defaulted_value(&unbin_out),"write pre-binarization CFG to this file") //TODO: ("cfg_uniq", defaulted_value(&uniq),"in case of duplicate rules, keep only the one with highest prob") ; binarize.AddOptions(opts); format.AddOptions(opts); } void Validate() { format.Validate(); binarize.Validate(); } void maybe_output_source(Hypergraph const& hg) { if (source_out.empty()) return; std::cerr<<"Printing source CFG to "<