00001 #ifndef MERT_CDER_SCORER_H_
00002 #define MERT_CDER_SCORER_H_
00003
00004 #include <string>
00005 #include <vector>
00006 #include "Types.h"
00007 #include "StatisticsBasedScorer.h"
00008
00009 namespace MosesTuning
00010 {
00011
00012
00016 class CderScorer: public StatisticsBasedScorer
00017 {
00018 public:
00019 explicit CderScorer(const std::string& config, bool allowed_long_jumps = true);
00020 ~CderScorer();
00021
00022 virtual void setReferenceFiles(const std::vector<std::string>& referenceFiles);
00023
00024 virtual void prepareStats(std::size_t sid, const std::string& text, ScoreStats& entry);
00025
00026 virtual void prepareStatsVector(std::size_t sid, const std::string& text, std::vector<ScoreStatsType>& stats);
00027
00028 virtual std::size_t NumberOfScores() const {
00029 return 2;
00030 }
00031
00032 virtual float calculateScore(const std::vector<ScoreStatsType>& comps) const;
00033
00034 private:
00035 bool m_allowed_long_jumps;
00036
00037 typedef std::vector<int> sent_t;
00038 std::vector<std::vector<sent_t> > m_ref_sentences;
00039
00040 void computeCD(const sent_t& cand, const sent_t& ref,
00041 std::vector<ScoreStatsType>& stats) const;
00042
00043
00044 CderScorer(const CderScorer&);
00045 CderScorer& operator=(const CderScorer&);
00046 };
00047
00048 }
00049
00050 #endif // MERT_CDER_SCORER_H_