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 <iostream>
|
|
|
|
#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"
|
|
|
|
#include "Scorer.h"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
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:
|
2011-11-12 05:16:31 +04:00
|
|
|
explicit TerScorer(const string& config = "");
|
|
|
|
~TerScorer();
|
|
|
|
|
2011-08-16 20:21:31 +04:00
|
|
|
virtual void setReferenceFiles(const vector<string>& referenceFiles);
|
|
|
|
virtual void prepareStats(size_t sid, const string& text, ScoreStats& entry);
|
2011-11-12 05:16:31 +04:00
|
|
|
|
2011-11-12 05:58:14 +04:00
|
|
|
virtual 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
|
|
|
|
2011-11-12 05:40:54 +04:00
|
|
|
virtual float calculateScore(const vector<int>& comps) const;
|
2011-08-16 20:21:31 +04:00
|
|
|
|
2012-02-01 16:36:25 +04:00
|
|
|
void whoami() const {
|
|
|
|
cerr << "I AM TerScorer" << std::endl;
|
|
|
|
}
|
|
|
|
|
2011-08-16 20:21:31 +04:00
|
|
|
private:
|
2011-11-12 05:16:31 +04:00
|
|
|
const int kLENGTH;
|
|
|
|
|
2012-02-01 15:54:20 +04:00
|
|
|
string m_java_env;
|
|
|
|
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-02-01 15:54:20 +04:00
|
|
|
vector<size_t> m_ref_lengths;
|
|
|
|
vector<multiset<int> > m_ref_tokens;
|
2011-08-16 20:21:31 +04:00
|
|
|
vector<vector<int> > m_references;
|
|
|
|
vector<vector<vector<int> > > m_multi_references;
|
|
|
|
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-02-20 04:46:08 +04:00
|
|
|
#endif // MERT_TER_SCORER_H_
|