diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2011-06-08 00:39:09 -0400 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2011-06-08 00:39:09 -0400 |
commit | 74d3ac177d70b77646f6a0b3b4095d725f893a36 (patch) | |
tree | 20dcdef45e5251a2058c29dbc06801f6ac68aa61 /mteval/external_scorer.h | |
parent | 4f3d61a3578dd99136913fc8cc8852fddcb50682 (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.h | 35 |
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 |