00001 #ifndef MERT_METEOR_SCORER_H_
00002 #define MERT_METEOR_SCORER_H_
00003
00004 #include <set>
00005 #include <string>
00006 #include <vector>
00007
00008 #ifdef WITH_THREADS
00009 #include <boost/thread/mutex.hpp>
00010 #endif
00011
00012 #include "Types.h"
00013 #include "StatisticsBasedScorer.h"
00014
00015 namespace MosesTuning
00016 {
00017
00018 class ofdstream;
00019 class ifdstream;
00020 class ScoreStats;
00021
00042 class MeteorScorer: public StatisticsBasedScorer
00043 {
00044 public:
00045 explicit MeteorScorer(const std::string& config = "");
00046 ~MeteorScorer();
00047
00048 virtual void setReferenceFiles(const std::vector<std::string>& referenceFiles);
00049 virtual void prepareStats(std::size_t sid, const std::string& text, ScoreStats& entry);
00050
00051 virtual std::size_t NumberOfScores() const {
00052
00053
00054
00055
00056
00057 return 23;
00058 }
00059
00060 virtual float getReferenceLength(const std::vector<ScoreStatsType>& totals) const {
00061
00062 return totals[1];
00063 }
00064
00065 virtual float calculateScore(const std::vector<ScoreStatsType>& comps) const;
00066
00067 private:
00068
00069 std::string meteor_jar;
00070 std::string meteor_lang;
00071 std::string meteor_task;
00072 std::string meteor_m;
00073 std::string meteor_p;
00074 std::string meteor_w;
00075 ofdstream* m_to_meteor;
00076 ifdstream* m_from_meteor;
00077 #ifdef WITH_THREADS
00078 mutable boost::mutex mtx;
00079 #endif // WITH_THREADS
00080
00081
00082 std::vector<std::string> m_references;
00083 std::vector<std::vector<std::string> > m_multi_references;
00084
00085
00086 MeteorScorer(const MeteorScorer&);
00087 MeteorScorer& operator=(const MeteorScorer&);
00088
00089 };
00090
00091 }
00092
00093 #endif // MERT_METEOR_SCORER_H_