Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ScorerFactory.cpp « mert - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2f47092ef3422ec992ae0d8d4b44830aeb40e6e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "ScorerFactory.h"

#include <stdexcept>
#include "Scorer.h"
#include "BleuScorer.h"
#include "PerScorer.h"
#include "TerScorer.h"
#include "CderScorer.h"
#include "MergeScorer.h"

using namespace std;

vector<string> ScorerFactory::getTypes() {
  vector<string> types;
  types.push_back(string("BLEU"));
  types.push_back(string("PER"));
  types.push_back(string("TER"));
  types.push_back(string("CDER"));
  types.push_back(string("MERGE"));
  return types;
}

Scorer* ScorerFactory::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 if (type == "TER") {
    return (TerScorer*) new TerScorer(config);
  } else if (type == "CDER") {
    return (CderScorer*) new CderScorer(config);
  } else if (type == "MERGE") {
    return (MergeScorer*) new MergeScorer(config);
  } else {
    throw runtime_error("Unknown scorer type: " + type);
  }
}