diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-01 19:22:06 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-01 19:22:06 +0000 |
commit | 0b925c0ca7e80805b461ce03418193e56ae76ab4 (patch) | |
tree | 1336a61e7aa3b21cc37e8a93b5ac2b13fb0d0cc0 /training | |
parent | e1bdd3ea0c018fa5071346d389766bff87a02efb (diff) |
collapse_weights --unnormalized
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@91 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'training')
-rw-r--r-- | training/collapse_weights.cc | 14 |
1 files changed, 12 insertions, 2 deletions
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 <iostream> #include <fstream> #include <tr1/unordered_map> @@ -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<string>(), "Grammar file") - ("weights,w", po::value<string>(), "Weights file"); + ("weights,w", po::value<string>(), "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<string>(), "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_]) |