2012-02-20 04:46:08 +04:00
|
|
|
#ifndef MERT_TER_SCORER_H_
|
|
|
|
#define MERT_TER_SCORER_H_
|
2011-08-16 20:21:31 +04:00
|
|
|
|
|
|
|
#include <set>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2011-11-14 10:15:30 +04:00
|
|
|
|
2011-08-16 20:21:31 +04:00
|
|
|
#include "Types.h"
|
2012-06-24 06:51:48 +04:00
|
|
|
#include "StatisticsBasedScorer.h"
|
2011-08-16 20:21:31 +04:00
|
|
|
|
2012-06-30 23:23:45 +04:00
|
|
|
namespace MosesTuning
|
|
|
|
{
|
2013-05-29 21:16:15 +04:00
|
|
|
|
2012-06-30 23:23:45 +04:00
|
|
|
|
2011-11-14 10:15:30 +04:00
|
|
|
class ScoreStats;
|
2011-08-16 20:21:31 +04:00
|
|
|
|
|
|
|
/**
|
2011-11-12 03:58:23 +04:00
|
|
|
* TER scoring
|
|
|
|
*/
|
2011-08-16 20:21:31 +04:00
|
|
|
class TerScorer: public StatisticsBasedScorer
|
|
|
|
{
|
|
|
|
public:
|
2012-05-10 02:51:05 +04:00
|
|
|
explicit TerScorer(const std::string& config = "");
|
2011-11-12 05:16:31 +04:00
|
|
|
~TerScorer();
|
|
|
|
|
2012-05-10 02:51:05 +04:00
|
|
|
virtual void setReferenceFiles(const std::vector<std::string>& referenceFiles);
|
|
|
|
virtual void prepareStats(std::size_t sid, const std::string& text, ScoreStats& entry);
|
2011-11-12 05:16:31 +04:00
|
|
|
|
2012-05-10 02:51:05 +04:00
|
|
|
virtual std::size_t NumberOfScores() const {
|
2011-08-20 19:25:19 +04:00
|
|
|
// cerr << "TerScorer: " << (LENGTH + 1) << endl;
|
2011-11-12 05:58:14 +04:00
|
|
|
return kLENGTH + 1;
|
2011-11-12 04:40:01 +04:00
|
|
|
}
|
2011-08-16 20:21:31 +04:00
|
|
|
|
2014-09-16 19:36:45 +04:00
|
|
|
virtual float calculateScore(const std::vector<ScoreStatsType>& comps) const;
|
2012-02-01 16:36:25 +04:00
|
|
|
|
2011-08-16 20:21:31 +04:00
|
|
|
private:
|
2011-11-12 05:16:31 +04:00
|
|
|
const int kLENGTH;
|
|
|
|
|
2012-05-10 02:51:05 +04:00
|
|
|
std::string m_java_env;
|
|
|
|
std::string m_ter_com_env;
|
2011-11-12 04:51:27 +04:00
|
|
|
|
2011-08-16 20:21:31 +04:00
|
|
|
// data extracted from reference files
|
2012-05-10 02:51:05 +04:00
|
|
|
std::vector<std::size_t> m_ref_lengths;
|
|
|
|
std::vector<std::multiset<int> > m_ref_tokens;
|
|
|
|
std::vector<std::vector<int> > m_references;
|
|
|
|
std::vector<std::vector<std::vector<int> > > m_multi_references;
|
|
|
|
std::string m_pid;
|
2011-11-12 05:16:31 +04:00
|
|
|
|
|
|
|
// no copying allowed
|
|
|
|
TerScorer(const TerScorer&);
|
|
|
|
TerScorer& operator=(const TerScorer&);
|
2011-08-16 20:21:31 +04:00
|
|
|
};
|
|
|
|
|
2012-06-30 23:23:45 +04:00
|
|
|
}
|
|
|
|
|
2012-02-20 04:46:08 +04:00
|
|
|
#endif // MERT_TER_SCORER_H_
|