diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2012-11-10 23:02:34 -0500 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2012-11-10 23:02:34 -0500 |
commit | fe29dcbab1ae427a1644b128b0ef30aa27647931 (patch) | |
tree | ea46fb3bcf2f6aa674a7e5f29051347993722355 /mteval | |
parent | 8d084476522ff267a25b8faa58e48879b5d0cdb6 (diff) |
set meteor path with environment variable
Diffstat (limited to 'mteval')
-rw-r--r-- | mteval/ns.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mteval/ns.cc b/mteval/ns.cc index 3af7cc63..f3a82ce0 100644 --- a/mteval/ns.cc +++ b/mteval/ns.cc @@ -12,6 +12,7 @@ #include <sstream> #include "tdict.h" +#include "filelib.h" #include "stringlib.h" using namespace std; @@ -234,7 +235,13 @@ struct BleuMetric : public EvaluationMetric { EvaluationMetric* EvaluationMetric::Instance(const string& imetric_id) { static bool is_first = true; + static string meteor_jar_path = "/cab0/tools/meteor-1.3/meteor-1.3.jar"; if (is_first) { + const char* ppath = getenv("METEOR_JAR"); + if (ppath) { + cerr << "METEOR_JAR environment variable set to " << ppath << endl; + meteor_jar_path = ppath; + } instances_["NULL"] = NULL; is_first = false; } @@ -252,7 +259,11 @@ EvaluationMetric* EvaluationMetric::Instance(const string& imetric_id) { } else if (metric_id == "TER") { m = new TERMetric; } else if (metric_id == "METEOR") { - m = new ExternalMetric("METEOR", "java -Xmx1536m -jar /cab0/tools/meteor-1.3/meteor-1.3.jar - - -mira -lower -t tune -l en"); + if (!FileExists(meteor_jar_path)) { + cerr << meteor_jar_path << " not found. Set METEOR_JAR environment variable.\n"; + abort(); + } + m = new ExternalMetric("METEOR", "java -Xmx1536m -jar " + meteor_jar_path + " - - -mira -lower -t tune -l en"); } else if (metric_id.find("COMB:") == 0) { m = new CombinationMetric(metric_id); } else if (metric_id == "CER") { |