diff options
author | Patrick Simianer <p@simianer.de> | 2011-10-19 14:02:34 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2011-10-19 14:02:34 +0200 |
commit | eb14e36d0b29f19321d44dd7dfa73cc703838d86 (patch) | |
tree | 1285e9e56959bc3a4b506e36bbc3b49f4e938fa0 /training/grammar_convert.cc | |
parent | 68f158b11df9f4072699fe6a4c8022ea54102b28 (diff) | |
parent | 04e38a57b19ea012895ac2efb39382c2e77833a9 (diff) |
merge upstream/master
Diffstat (limited to 'training/grammar_convert.cc')
-rw-r--r-- | training/grammar_convert.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/training/grammar_convert.cc b/training/grammar_convert.cc index 8d292f8a..bf8abb26 100644 --- a/training/grammar_convert.cc +++ b/training/grammar_convert.cc @@ -251,12 +251,10 @@ int main(int argc, char **argv) { const bool is_split_input = (conf["format"].as<string>() == "split"); const bool is_json_input = is_split_input || (conf["format"].as<string>() == "json"); const bool collapse_weights = conf.count("collapse_weights"); - Weights wts; vector<double> w; - if (conf.count("weights")) { - wts.InitFromFile(conf["weights"].as<string>()); - wts.InitVector(&w); - } + if (conf.count("weights")) + Weights::InitFromFile(conf["weights"].as<string>(), &w); + if (collapse_weights && !w.size()) { cerr << "--collapse_weights requires a weights file to be specified!\n"; exit(1); |