diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2012-05-23 18:02:48 -0400 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2012-05-23 18:02:48 -0400 |
commit | d60dda793ce24818becf6dfb140579899a5e121b (patch) | |
tree | c75da9045295be3768a13f21f5fe09907229cf05 /dpmert | |
parent | 57339faa0074d35783213b03f921ee7ad13f9481 (diff) |
more bjam stuff, more cleanup
Diffstat (limited to 'dpmert')
-rw-r--r-- | dpmert/Jamfile | 30 | ||||
-rw-r--r-- | dpmert/ces.cc | 2 | ||||
-rw-r--r-- | dpmert/lo_test.cc | 4 | ||||
-rw-r--r-- | dpmert/mr_dpmert_generate_mapper_input.cc | 7 | ||||
-rw-r--r-- | dpmert/mr_dpmert_map.cc | 2 |
5 files changed, 39 insertions, 6 deletions
diff --git a/dpmert/Jamfile b/dpmert/Jamfile new file mode 100644 index 00000000..d96c592c --- /dev/null +++ b/dpmert/Jamfile @@ -0,0 +1,30 @@ +import testing ; +import lex ; +import option ; + +lib dpmert : + ces.cc + error_surface.cc + line_optimizer.cc + mert_geometry.cc + ..//utils + ..//mteval + ..//decoder + ../klm/lm//kenlm + ..//boost_program_options + : <include>. + : : + <library>..//utils + <library>..//mteval + <library>../klm/lm//kenlm + <library>..//boost_program_options + <include>. + ; + +all_tests [ glob *_test.cc ] : dpmert : <testing.arg>$(TOP)/dpmert/test_data ; + +exe sentserver : sentserver.c ; +exe sentclient : sentclient.c ; +exe mr_dpmert_generate_mapper_input : mr_dpmert_generate_mapper_input.cc dpmert ..//boost_program_options ; +exe mr_dpmert_map : mr_dpmert_map.cc dpmert ..//boost_program_options ; +exe mr_dpmert_reduce : mr_dpmert_reduce.cc dpmert ..//boost_program_options ; diff --git a/dpmert/ces.cc b/dpmert/ces.cc index c6cb1cdf..157b2d17 100644 --- a/dpmert/ces.cc +++ b/dpmert/ces.cc @@ -25,7 +25,7 @@ void ComputeErrorSurface(const SegmentEvaluator& ss, env->resize(ienv.size()); SufficientStats prev_score; // defaults to 0 int j = 0; - for (int i = 0; i < ienv.size(); ++i) { + for (unsigned i = 0; i < ienv.size(); ++i) { const MERTPoint& seg = *ienv[i]; vector<WordID> trans; #if 0 diff --git a/dpmert/lo_test.cc b/dpmert/lo_test.cc index d47a95b5..f6df523e 100644 --- a/dpmert/lo_test.cc +++ b/dpmert/lo_test.cc @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE(TestConvexHullInside) { if (!d) break; cerr << log(d->score) << " ||| " << TD::GetString(d->yield) << " ||| " << d->feature_values << endl; } - for (int i = 0; i < segs.size(); ++i) { + for (unsigned i = 0; i < segs.size(); ++i) { cerr << "seg=" << i << endl; vector<WordID> trans; segs[i]->ConstructTranslation(&trans); @@ -149,7 +149,7 @@ BOOST_AUTO_TEST_CASE( TestS1) { &rng, &axes); assert(axes.size() == 10 + to_optimize.size()); - for (int i = 0; i < axes.size(); ++i) + for (unsigned i = 0; i < axes.size(); ++i) cerr << axes[i] << endl; const SparseVector<double>& axis = axes[0]; diff --git a/dpmert/mr_dpmert_generate_mapper_input.cc b/dpmert/mr_dpmert_generate_mapper_input.cc index 59d4f24f..199cd23a 100644 --- a/dpmert/mr_dpmert_generate_mapper_input.cc +++ b/dpmert/mr_dpmert_generate_mapper_input.cc @@ -52,12 +52,15 @@ int main(int argc, char** argv) { Weights::InitFromFile(conf["weights"].as<string>(), &w, &features); Weights::InitSparseVector(w, &origin); const string forest_repository = conf["forest_repository"].as<string>(); - assert(DirectoryExists(forest_repository)); + if (!DirectoryExists(forest_repository)) { + cerr << "Forest repository directory " << forest_repository << " not found!\n"; + return 1; + } if (conf.count("optimize_feature") > 0) features=conf["optimize_feature"].as<vector<string> >(); vector<SparseVector<weight_t> > directions; vector<int> fids(features.size()); - for (int i = 0; i < features.size(); ++i) + for (unsigned i = 0; i < features.size(); ++i) fids[i] = FD::Convert(features[i]); LineOptimizer::CreateOptimizationDirections( fids, diff --git a/dpmert/mr_dpmert_map.cc b/dpmert/mr_dpmert_map.cc index f3304f0f..d1efcf96 100644 --- a/dpmert/mr_dpmert_map.cc +++ b/dpmert/mr_dpmert_map.cc @@ -52,7 +52,7 @@ bool ReadSparseVectorString(const string& s, SparseVector<double>* v) { vector<string> fields; Tokenize(s, ';', &fields); if (fields.empty()) return false; - for (int i = 0; i < fields.size(); ++i) { + for (unsigned i = 0; i < fields.size(); ++i) { vector<string> pair(2); Tokenize(fields[i], '=', &pair); if (pair.size() != 2) { |