mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 05:55:02 +03:00
83f234cf17
as --scconfig regtype:min,regwin:3 in extractor and mert. Only tested on toy example so far. git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1860 1f5c12ca-751b-0410-a591-d2e778427230
42 lines
954 B
C++
42 lines
954 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
|