mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@3899 1f5c12ca-751b-0410-a591-d2e778427230
43 lines
857 B
C++
43 lines
857 B
C++
#ifndef __SCORER_FACTORY_H
|
|
#define __SCORER_FACTORY_H
|
|
|
|
#include <algorithm>
|
|
#include <cmath>
|
|
#include <iostream>
|
|
#include <iterator>
|
|
#include <set>
|
|
#include <sstream>
|
|
#include <stdexcept>
|
|
#include <string>
|
|
#include <vector>
|
|
#include "Types.h"
|
|
#include "Scorer.h"
|
|
#include "BleuScorer.h"
|
|
#include "PerScorer.h"
|
|
|
|
using namespace std;
|
|
|
|
class ScorerFactory
|
|
{
|
|
|
|
public:
|
|
vector<string> getTypes() {
|
|
vector<string> types;
|
|
types.push_back(string("BLEU"));
|
|
types.push_back(string("PER"));
|
|
return types;
|
|
}
|
|
|
|
Scorer* getScorer(const string& type, const string& config = "") {
|
|
if (type == "BLEU") {
|
|
return (BleuScorer*) new BleuScorer(config);
|
|
} else if (type == "PER") {
|
|
return (PerScorer*) new PerScorer(config);
|
|
} else {
|
|
throw runtime_error("Unknown scorer type: " + type);
|
|
}
|
|
}
|
|
};
|
|
|
|
#endif //__SCORER_FACTORY_H
|