mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
This change might be useful to avoid duplicating the names. The reason is that although MERT programs are standalone applications, some header files such as data.h and point.h have common guard macro names like "DATA_H" and "POINT_H", and this is not good naming conventions when you want to include external headers. Some files actually include headers in Moses and KenLM's util.
58 lines
1.2 KiB
C++
58 lines
1.2 KiB
C++
#ifndef MERT_TER_SCORER_H_
|
|
#define MERT_TER_SCORER_H_
|
|
|
|
#include <iostream>
|
|
#include <set>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "Types.h"
|
|
#include "Scorer.h"
|
|
|
|
using namespace std;
|
|
|
|
class ScoreStats;
|
|
|
|
/**
|
|
* TER scoring
|
|
*/
|
|
class TerScorer: public StatisticsBasedScorer
|
|
{
|
|
public:
|
|
explicit TerScorer(const string& config = "");
|
|
~TerScorer();
|
|
|
|
virtual void setReferenceFiles(const vector<string>& referenceFiles);
|
|
virtual void prepareStats(size_t sid, const string& text, ScoreStats& entry);
|
|
|
|
virtual size_t NumberOfScores() const {
|
|
// cerr << "TerScorer: " << (LENGTH + 1) << endl;
|
|
return kLENGTH + 1;
|
|
}
|
|
|
|
virtual float calculateScore(const vector<int>& comps) const;
|
|
|
|
void whoami() const {
|
|
cerr << "I AM TerScorer" << std::endl;
|
|
}
|
|
|
|
private:
|
|
const int kLENGTH;
|
|
|
|
string m_java_env;
|
|
string m_ter_com_env;
|
|
|
|
// data extracted from reference files
|
|
vector<size_t> m_ref_lengths;
|
|
vector<multiset<int> > m_ref_tokens;
|
|
vector<vector<int> > m_references;
|
|
vector<vector<vector<int> > > m_multi_references;
|
|
string m_pid;
|
|
|
|
// no copying allowed
|
|
TerScorer(const TerScorer&);
|
|
TerScorer& operator=(const TerScorer&);
|
|
};
|
|
|
|
#endif // MERT_TER_SCORER_H_
|