summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarmatthews <armatthe@cmu.edu>2015-04-09 00:44:09 -0400
committerarmatthews <armatthe@cmu.edu>2015-04-09 00:44:09 -0400
commit9d2a9d727380649310fd1d26b1918e88b8e284d6 (patch)
treef4d426cd00ab1565a4671c4cc293992fb78c169b
parentd18a8f8495ad4c910660be128c0f6843593f4999 (diff)
added WER as a possible tuning metric
-rw-r--r--mteval/CMakeLists.txt1
-rw-r--r--mteval/scorer.cc8
-rw-r--r--mteval/scorer.h2
3 files changed, 9 insertions, 2 deletions
diff --git a/mteval/CMakeLists.txt b/mteval/CMakeLists.txt
index 8217c116..7398f01c 100644
--- a/mteval/CMakeLists.txt
+++ b/mteval/CMakeLists.txt
@@ -52,6 +52,7 @@ set(mteval_STAT_SRCS
comb_scorer.cc
external_scorer.cc
meteor_jar.cc
+ wer.cc
ns.cc
ns_cer.cc
ns_comb.cc
diff --git a/mteval/scorer.cc b/mteval/scorer.cc
index fedbca91..4c05dbd8 100644
--- a/mteval/scorer.cc
+++ b/mteval/scorer.cc
@@ -14,6 +14,7 @@
#include "filelib.h"
#include "ter.h"
#include "aer_scorer.h"
+#include "wer.h"
#include "comb_scorer.h"
#include "tdict.h"
#include "stringlib.h"
@@ -46,12 +47,14 @@ ScoreType ScoreTypeFromString(const string& st) {
return BLEU_minus_TER_over_2;
if (sl == "meteor")
return METEOR;
+ if (sl == "wer")
+ return WER;
cerr << "Don't understand score type '" << st << "', defaulting to ibm_bleu.\n";
return IBM_BLEU;
}
static char const* score_names[]={
- "IBM_BLEU", "NIST_BLEU", "Koehn_BLEU", "TER", "BLEU_minus_TER_over_2", "SER", "AER", "IBM_BLEU_3", "METEOR"
+ "IBM_BLEU", "NIST_BLEU", "Koehn_BLEU", "TER", "BLEU_minus_TER_over_2", "SER", "AER", "IBM_BLEU_3", "METEOR", "WER"
};
std::string StringFromScoreType(ScoreType st) {
@@ -360,6 +363,7 @@ ScorerP SentenceScorer::CreateSentenceScorer(const ScoreType type,
case SER: r = new SERScorer(refs);break;
case BLEU_minus_TER_over_2: r = new BLEUTERCombinationScorer(refs);break;
case METEOR: r = new ExternalSentenceScorer(ScoreServerManager::Instance("meteor"), refs); break;
+ case WER: r = new WERScorer(refs);break;
default:
assert(!"Not implemented!");
}
@@ -404,6 +408,8 @@ ScoreP SentenceScorer::CreateScoreFromString(const ScoreType type, const string&
return BLEUTERCombinationScorer::ScoreFromString(in);
case METEOR:
return ExternalSentenceScorer::ScoreFromString(ScoreServerManager::Instance("meteor"), in);
+ case WER:
+ return WERScorer::ScoreFromString(in);
default:
assert(!"Not implemented!");
}
diff --git a/mteval/scorer.h b/mteval/scorer.h
index 8d986612..a411f14b 100644
--- a/mteval/scorer.h
+++ b/mteval/scorer.h
@@ -17,7 +17,7 @@ class ErrorSurface;
class Hypergraph; // needed for alignment
//TODO: BLEU N (N separate arg, not part of enum)?
-enum ScoreType { IBM_BLEU, NIST_BLEU, Koehn_BLEU, TER, BLEU_minus_TER_over_2, SER, AER, IBM_BLEU_3, METEOR };
+enum ScoreType { IBM_BLEU, NIST_BLEU, Koehn_BLEU, TER, BLEU_minus_TER_over_2, SER, AER, IBM_BLEU_3, METEOR, WER };
ScoreType ScoreTypeFromString(const std::string& st);
std::string StringFromScoreType(ScoreType st);