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 | f56b7c1e35c38116d99b06458f2c63dda939a8cc (patch) | |
tree | e87862d279bfaa41795a0e3854ecece75f68367c /mteval/ns.cc | |
parent | 0ba01f2cb8e05f37d4253ccf87237cb6650caeed (diff) |
set meteor path with environment variable
Diffstat (limited to 'mteval/ns.cc')
-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") { |