summaryrefslogtreecommitdiff
path: root/mteval
diff options
context:
space:
mode:
authorMichael Denkowski <michael.j.denkowski@gmail.com>2012-12-22 16:01:23 -0500
committerMichael Denkowski <michael.j.denkowski@gmail.com>2012-12-22 16:01:23 -0500
commit597d89c11db53e91bc011eab70fd613bbe6453e8 (patch)
tree83c87c07d1ff6d3ee4e3b1626f7eddd49c61095b /mteval
parent65e958ff2678a41c22be7171456a63f002ef370b (diff)
parent201af2acd394415a05072fbd53d42584875aa4b4 (diff)
Merge branch 'master' of git://github.com/redpony/cdec
Diffstat (limited to 'mteval')
-rw-r--r--mteval/Makefile.am20
-rw-r--r--mteval/meteor_jar.cc.in3
-rw-r--r--mteval/ns.cc17
3 files changed, 28 insertions, 12 deletions
diff --git a/mteval/Makefile.am b/mteval/Makefile.am
index 22550c99..4444285f 100644
--- a/mteval/Makefile.am
+++ b/mteval/Makefile.am
@@ -8,15 +8,27 @@ TESTS = scorer_test
noinst_LIBRARIES = libmteval.a
-libmteval_a_SOURCES = ter.cc comb_scorer.cc aer_scorer.cc scorer.cc external_scorer.cc ns.cc ns_ter.cc ns_ext.cc ns_comb.cc ns_docscorer.cc ns_cer.cc
+libmteval_a_SOURCES = \
+ aer_scorer.cc \
+ comb_scorer.cc \
+ external_scorer.cc \
+ meteor_jar.cc \
+ ns.cc \
+ ns_cer.cc \
+ ns_comb.cc \
+ ns_docscorer.cc \
+ ns_ext.cc \
+ ns_ter.cc \
+ scorer.cc \
+ ter.cc
fast_score_SOURCES = fast_score.cc
-fast_score_LDADD = libmteval.a $(top_srcdir)/utils/libutils.a -lz
+fast_score_LDADD = libmteval.a $(top_srcdir)/utils/libutils.a
mbr_kbest_SOURCES = mbr_kbest.cc
-mbr_kbest_LDADD = libmteval.a $(top_srcdir)/utils/libutils.a -lz
+mbr_kbest_LDADD = libmteval.a $(top_srcdir)/utils/libutils.a
scorer_test_SOURCES = scorer_test.cc
-scorer_test_LDADD = libmteval.a $(top_srcdir)/utils/libutils.a $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) -lz
+scorer_test_LDADD = libmteval.a $(top_srcdir)/utils/libutils.a $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS)
AM_CPPFLAGS = -DBOOST_TEST_DYN_LINK -W -Wall -Wno-sign-compare $(GTEST_CPPFLAGS) -I$(top_srcdir)/utils
diff --git a/mteval/meteor_jar.cc.in b/mteval/meteor_jar.cc.in
new file mode 100644
index 00000000..fe45a72a
--- /dev/null
+++ b/mteval/meteor_jar.cc.in
@@ -0,0 +1,3 @@
+
+const char* meteor_jar_path = "@METEOR_JAR@";
+
diff --git a/mteval/ns.cc b/mteval/ns.cc
index f3a82ce0..7d73061c 100644
--- a/mteval/ns.cc
+++ b/mteval/ns.cc
@@ -19,6 +19,8 @@ using namespace std;
map<string, EvaluationMetric*> EvaluationMetric::instances_;
+extern const char* meteor_jar_path;
+
SegmentEvaluator::~SegmentEvaluator() {}
EvaluationMetric::~EvaluationMetric() {}
@@ -235,13 +237,7 @@ 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;
}
@@ -259,11 +255,16 @@ EvaluationMetric* EvaluationMetric::Instance(const string& imetric_id) {
} else if (metric_id == "TER") {
m = new TERMetric;
} else if (metric_id == "METEOR") {
+#if HAVE_METEOR
if (!FileExists(meteor_jar_path)) {
- cerr << meteor_jar_path << " not found. Set METEOR_JAR environment variable.\n";
+ cerr << meteor_jar_path << " not found!\n";
abort();
}
- m = new ExternalMetric("METEOR", "java -Xmx1536m -jar " + meteor_jar_path + " - - -mira -lower -t tune -l en");
+ m = new ExternalMetric("METEOR", string("java -Xmx1536m -jar ") + meteor_jar_path + " - - -mira -lower -t tune -l en");
+#else
+ cerr << "cdec was not built with the --with-meteor option." << endl;
+ abort();
+#endif
} else if (metric_id.find("COMB:") == 0) {
m = new CombinationMetric(metric_id);
} else if (metric_id == "CER") {