diff options
author | Kenneth Heafield <github@kheafield.com> | 2011-11-30 14:57:22 +0400 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2011-11-30 15:13:42 +0400 |
commit | 7b4dad0742cbe9220a1512cc15537b449d49d402 (patch) | |
tree | 97dc44da8728bc5f748da4acd4f39a4ba65e15f5 /lm | |
parent | ec9db80c7a2517457092f8f7f2f0e271e1e70c78 (diff) |
Nicer success message. Clean up some redundancy.
Diffstat (limited to 'lm')
-rw-r--r-- | lm/build_binary.cc | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/lm/build_binary.cc b/lm/build_binary.cc index 4511a8b9a..e235cc5a3 100644 --- a/lm/build_binary.cc +++ b/lm/build_binary.cc @@ -160,43 +160,45 @@ int main(int argc, char *argv[]) { } if (optind + 1 == argc) { ShowSizes(argv[optind], config); - } else if (optind + 2 == argc) { + return 0; + } + const char *model_type, *from_file; + if (optind + 2 == argc) { + model_type = "probing"; + from_file = argv[optind]; config.write_mmap = argv[optind + 1]; - if (quantize || set_backoff_bits) ProbingQuantizationUnsupported(); - ProbingModel(argv[optind], config); } else if (optind + 3 == argc) { - const char *model_type = argv[optind]; - const char *from_file = argv[optind + 1]; + model_type = argv[optind]; + from_file = argv[optind + 1]; config.write_mmap = argv[optind + 2]; - if (!strcmp(model_type, "probing")) { - if (quantize || set_backoff_bits) ProbingQuantizationUnsupported(); - ProbingModel(from_file, config); - } else if (!strcmp(model_type, "trie")) { - if (quantize) { - if (bhiksha) { - QuantArrayTrieModel(from_file, config); - } else { - QuantTrieModel(from_file, config); - } + } else { + Usage(argv[0]); + } + if (!strcmp(model_type, "probing")) { + if (quantize || set_backoff_bits) ProbingQuantizationUnsupported(); + ProbingModel(from_file, config); + } else if (!strcmp(model_type, "trie")) { + if (quantize) { + if (bhiksha) { + QuantArrayTrieModel(from_file, config); } else { - if (bhiksha) { - ArrayTrieModel(from_file, config); - } else { - TrieModel(from_file, config); - } + QuantTrieModel(from_file, config); } } else { - Usage(argv[0]); + if (bhiksha) { + ArrayTrieModel(from_file, config); + } else { + TrieModel(from_file, config); + } } } else { Usage(argv[0]); } - } - catch (const std::exception &e) { + std::cerr << "Built " << config.write_mmap << " successfully." << std::endl; + } catch (const std::exception &e) { std::cerr << e.what() << std::endl; return 1; } - std::cerr << "KenLM build_binary SUCCESS" << std::endl; return 0; } |