From 0b925c0ca7e80805b461ce03418193e56ae76ab4 Mon Sep 17 00:00:00 2001 From: graehl Date: Thu, 1 Jul 2010 19:22:06 +0000 Subject: collapse_weights --unnormalized git-svn-id: https://ws10smt.googlecode.com/svn/trunk@91 ec762483-ff6d-05da-a07a-a48fb63a330f --- training/collapse_weights.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'training') diff --git a/training/collapse_weights.cc b/training/collapse_weights.cc index 5e0f3f72..4fb742fb 100644 --- a/training/collapse_weights.cc +++ b/training/collapse_weights.cc @@ -1,3 +1,10 @@ +char const* NOTES = + "ZF_and_E means unnormalized scaled features.\n" + "For grammars with one nonterminal: F_and_E is joint,\n" + "F_given_E and E_given_F are conditional.\n" + "TODO: group rules by root nonterminal and then normalize.\n"; + + #include #include #include @@ -20,7 +27,9 @@ void InitCommandLine(int argc, char** argv, po::variables_map* conf) { po::options_description opts("Configuration options"); opts.add_options() ("grammar,g", po::value(), "Grammar file") - ("weights,w", po::value(), "Weights file"); + ("weights,w", po::value(), "Weights file") + ("unnormalized,u", "Always include ZF_and_E unnormalized score (default: only if sum was >1)") + ; po::options_description clo("Command line options"); clo.add_options() ("config,c", po::value(), "Configuration file") @@ -40,6 +49,7 @@ void InitCommandLine(int argc, char** argv, po::variables_map* conf) { if (conf->count("help") || !conf->count("grammar") || !conf->count("weights")) { cerr << dcmdline_options << endl; + cerr << NOTES << endl; exit(1); } } @@ -91,7 +101,7 @@ int main(int argc, char** argv) { tr.scores_.clear(); cout << tr.AsString() << " ||| F_and_E=" << lp - log(tot); - if (!normalized) { + if (!normalized || conf.count("unnormalized")) { cout << ";ZF_and_E=" << lp; } cout << ";F_given_E=" << lp - log(e_tots[tr.e_]) -- cgit v1.2.3