mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-29 06:52:34 +03:00
642e8dce95
evaluator --sctype PER --reference ref.file --candidate cand.file usage: evaluator [options] --reference ref1[,ref2[,ref3...]] --candidate cand1[,cand2[,cand3...]] [--sctype|-s] the scorer type (default BLEU) [--scconfig|-c] configuration string passed to scorer This is of the form NAME1:VAL1,NAME2:VAL2 etc [--reference|-R] comma separated list of reference files [--candidate|-C] comma separated list of candidate files [--bootstrap|-b] number of booststraped samples (default 0 - no bootstraping) [--rseed|-r] the random seed for bootstraping (defaults to system clock) [--help|-h] print this message and exit git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@4153 1f5c12ca-751b-0410-a591-d2e778427230
68 lines
1.5 KiB
C++
68 lines
1.5 KiB
C++
#ifndef __TERSCORER_H__
|
|
#define __TERSCORER_H__
|
|
|
|
// #include <stdio.h>
|
|
#include <algorithm>
|
|
#include <cmath>
|
|
#include <iostream>
|
|
#include <iterator>
|
|
#include <set>
|
|
#include <sstream>
|
|
#include <stdexcept>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <limits.h>
|
|
#include "Types.h"
|
|
#include "ScoreData.h"
|
|
#include "Scorer.h"
|
|
#include "TERsrc/tercalc.h"
|
|
#include "TERsrc/terAlignment.h"
|
|
|
|
using namespace std;
|
|
using namespace TERCpp;
|
|
|
|
// enum TerReferenceLengthStrategy { TER_AVERAGE, TER_SHORTEST, TER_CLOSEST };
|
|
|
|
|
|
/**
|
|
* Bleu scoring
|
|
**/
|
|
class TerScorer: public StatisticsBasedScorer
|
|
{
|
|
public:
|
|
TerScorer(const string& config = "") : StatisticsBasedScorer("TER",config) {}
|
|
virtual void setReferenceFiles(const vector<string>& referenceFiles);
|
|
virtual void prepareStats(size_t sid, const string& text, ScoreStats& entry);
|
|
static const int LENGTH;
|
|
virtual void whoami() {
|
|
cerr << "I AM TerScorer" << std::endl;
|
|
}
|
|
size_t NumberOfScores() {
|
|
// cerr << "TerScorer: " << (LENGTH + 1) << endl;
|
|
return (LENGTH + 1);
|
|
};
|
|
|
|
|
|
// protected:
|
|
float calculateScore(const vector<int>& comps);
|
|
float calculateScore(const vector<float>& comps);
|
|
|
|
private:
|
|
string javaEnv;
|
|
string tercomEnv;
|
|
//no copy
|
|
TerScorer(const TerScorer&);
|
|
~TerScorer() {};
|
|
TerScorer& operator=(const TerScorer&);
|
|
// data extracted from reference files
|
|
vector<size_t> _reflengths;
|
|
vector<multiset<int> > _reftokens;
|
|
vector<vector<int> > m_references;
|
|
vector<vector<vector<int> > > m_multi_references;
|
|
string m_pid;
|
|
|
|
};
|
|
|
|
|
|
#endif //__TERSCORER_H
|