diff options
author | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-02-01 11:33:23 +0400 |
---|---|---|
committer | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-02-01 11:33:23 +0400 |
commit | 8007150db4f9f0cff6fe602b4c5b00ad04e38cb5 (patch) | |
tree | 6945241c76507ebd459242e1cab277f1f75b2dbf /mert | |
parent | c3fbe5081ef9150f5ace0d0ecf9c49ff8af7c857 (diff) |
Add constans to prevent avoid hard coding many times.
Default filenames in usage() were differen from the actual ones.
Diffstat (limited to 'mert')
-rwxr-xr-x | mert/mert.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/mert/mert.cpp b/mert/mert.cpp index ced9018f7..18b444882 100755 --- a/mert/mert.cpp +++ b/mert/mert.cpp @@ -29,6 +29,12 @@ using namespace std; namespace { +const char kDefaultOptimizer[] = "powell"; +const char kDefaultScorer[] = "BLEU"; +const char kDefaultScorerFile[] = "statscore.data"; +const char kDefaultFeatureFile[] = "features.data"; +const char kDefaultInitFile[] = "init.opt"; + /** * Runs an optimisation, or a random restart. */ @@ -77,13 +83,13 @@ void usage(int ret) cerr << "[-n] retry ntimes (default 1)" << endl; cerr << "[-m] number of random directions in powell (default 0)"<< endl; cerr << "[-o] the indexes to optimize(default all)" << endl; - cerr << "[-t] the optimizer(default powell)" << endl; + cerr << "[-t] the optimizer(default " << kDefaultOptimizer << ")" << endl; cerr << "[-r] the random seed (defaults to system clock)" << endl; - cerr << "[--sctype|-s] the scorer type (default BLEU)" << endl; + cerr << "[--sctype|-s] the scorer type (default " << kDefaultScorer << ")" << endl; cerr << "[--scconfig|-c] configuration string passed to scorer" << endl; - cerr << "[--scfile|-S] comma separated list of scorer data files (default score.data)" << endl; - cerr << "[--ffile|-F] comma separated list of feature data files (default feature.data)" << endl; - cerr << "[--ifile|-i] the starting point data file (default init.opt)" << endl; + cerr << "[--scfile|-S] comma separated list of scorer data files (default " << kDefaultScorerFile << ")" << endl; + cerr << "[--ffile|-F] comma separated list of feature data files (default " << kDefaultFeatureFile << ")" << endl; + cerr << "[--ifile|-i] the starting point data file (default " << kDefaultInitFile << ")" << endl; #ifdef WITH_THREADS cerr << "[--threads|-T] use multiple threads (default 1)" << endl; #endif @@ -141,12 +147,12 @@ struct ProgramOption { nrandom(0), seed(0), has_seed(false), - optimize_type("powell"), - scorer_type("BLEU"), + optimize_type(kDefaultOptimizer), + scorer_type(kDefaultScorer), scorer_config(""), - scorer_file("statscore.data"), - feature_file("features.data"), - init_file("init.opt"), + scorer_file(kDefaultScorerFile), + feature_file(kDefaultFeatureFile), + init_file(kDefaultInitFile), num_threads(1), shard_size(0), shard_count(0) { } |