diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-11 01:34:57 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-11 01:34:57 +0000 |
commit | 73afb7c218f7a10c38a58772a1530a7a99047b90 (patch) | |
tree | 3518757b81b2fbcdecde1eed46b5683d023b951d /decoder/cfg_options.h | |
parent | 991969850eede6eca5c8724484175b1f3c0ddeff (diff) |
debug cfg from hg, source and target. cdec --source_cfg_output=-
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@507 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/cfg_options.h')
-rwxr-xr-x | decoder/cfg_options.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/decoder/cfg_options.h b/decoder/cfg_options.h index cbbe3b42..956586f0 100755 --- a/decoder/cfg_options.h +++ b/decoder/cfg_options.h @@ -9,7 +9,7 @@ struct CFGOptions { CFGFormat format; CFGBinarize binarize; - std::string cfg_output; + std::string cfg_output,source_cfg_output; void set_defaults() { format.set_defaults(); binarize.set_defaults(); @@ -19,7 +19,8 @@ struct CFGOptions { template <class Opts> // template to support both printable_opts and boost nonprintable void AddOptions(Opts *opts) { opts->add_options() - ("cfg_output", defaulted_value(&cfg_output),"write final target CFG (before FSA rescorinn) to this file") + ("cfg_output", defaulted_value(&cfg_output),"write final target CFG (before FSA rescoring) to this file") + ("source_cfg_output", defaulted_value(&source_cfg_output),"write source CFG (after prelm-scoring, prelm-prune) to this file") ; binarize.AddOptions(opts); format.AddOptions(opts); @@ -31,9 +32,16 @@ struct CFGOptions { char const* description() const { return "CFG output options"; } + void maybe_output_source(Hypergraph const& hg) { + if (source_cfg_output.empty()) return; + std::cerr<<"Printing source CFG to "<<source_cfg_output<<": "<<format<<'\n'; + WriteFile o(source_cfg_output); + CFG cfg(hg,false,format.features,format.goal_nt()); + cfg.Print(o.get(),format); + } void maybe_output(HgCFG &hgcfg) { if (cfg_output.empty()) return; - std::cerr<<"Printing CFG to "<<cfg_output<<": "<<format<<'\n'; + std::cerr<<"Printing target CFG to "<<cfg_output<<": "<<format<<'\n'; WriteFile o(cfg_output); maybe_binarize(hgcfg); hgcfg.GetCFG().Print(o.get(),format); @@ -43,7 +51,6 @@ struct CFGOptions { hgcfg.GetCFG().Binarize(binarize); hgcfg.binarized=true; } - }; |