summaryrefslogtreecommitdiff
path: root/mteval/external_scorer.h
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2011-06-08 00:39:09 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2011-06-08 00:39:09 -0400
commitdc9cd6987abdfc703f50e924fa9e55dc702d5242 (patch)
tree53520110c90fa9e087efed2378ecae80b76404fb /mteval/external_scorer.h
parent925d74ce8a92ec6e73f41a4f0685bf3ca7b865d1 (diff)
external MT evaluator client code. most logic in place, needs to be integrated. actually, the whole evaluation architecture needs to be trashed and rewritten from scratch. what a disaster it is
Diffstat (limited to 'mteval/external_scorer.h')
-rw-r--r--mteval/external_scorer.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/mteval/external_scorer.h b/mteval/external_scorer.h
new file mode 100644
index 00000000..a2c91960
--- /dev/null
+++ b/mteval/external_scorer.h
@@ -0,0 +1,35 @@
+#ifndef _EXTERNAL_SCORER_H_
+#define _EXTERNAL_SCORER_H_
+
+#include <vector>
+#include <cstdio>
+
+#include "scorer.h"
+
+class ScoreServer {
+ public:
+ explicit ScoreServer(const std::string& cmd);
+ virtual ~ScoreServer();
+
+ double ComputeScore(const std::vector<float>& fields);
+ void Evaluate(const std::vector<std::vector<WordID> >& refs, const std::vector<WordID>& hyp, std::vector<float>* fields);
+
+ private:
+ void RequestResponse(const std::string& request, std::string* response);
+ FILE* pipe_;
+};
+
+class ExternalSentenceScorer : public SentenceScorer {
+ public:
+ virtual ScoreP ScoreCandidate(const Sentence& hyp) const = 0;
+ virtual ScoreP ScoreCCandidate(const Sentence& hyp) const =0;
+ protected:
+ ScoreServer* eval_server;
+};
+
+class METEORServer : public ScoreServer {
+ public:
+ METEORServer() : ScoreServer("java -Xmx1024m -jar meteor-1.3.jar - - -mira -lower") {}
+};
+
+#endif