diff options
author | nicolabertoldi <nicolabertoldi@1f5c12ca-751b-0410-a591-d2e778427230> | 2008-06-03 12:56:37 +0400 |
---|---|---|
committer | nicolabertoldi <nicolabertoldi@1f5c12ca-751b-0410-a591-d2e778427230> | 2008-06-03 12:56:37 +0400 |
commit | 1402f3036b583f901b9e973e0d0f0067623d8265 (patch) | |
tree | 00bfdda3fd0edeb385838107732544c999bdefa5 /mert/ScorerFactory.h | |
parent | 1792e14945cc8655bc81d32150f78746841e3871 (diff) |
added ScorerFactory.h
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1811 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'mert/ScorerFactory.h')
-rw-r--r-- | mert/ScorerFactory.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/mert/ScorerFactory.h b/mert/ScorerFactory.h new file mode 100644 index 000000000..9afe36988 --- /dev/null +++ b/mert/ScorerFactory.h @@ -0,0 +1,41 @@ +#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) { + if (type == "BLEU") { + return (BleuScorer*) new BleuScorer(); + } else if (type == "PER") { + return (PerScorer*) new PerScorer(); + } else { + throw runtime_error("Unknown scorer type: " + type); + } + } +}; + +#endif //__SCORER_FACTORY_H |