summaryrefslogtreecommitdiff
path: root/mteval/ns_cer.h
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2012-08-03 07:46:54 -0400
committerKenneth Heafield <github@kheafield.com>2012-08-03 07:46:54 -0400
commit122f46c31102b683eaab3ad81a3a98accbc694bb (patch)
tree8d499d789b159ebed25bb23b6983813d064a6296 /mteval/ns_cer.h
parentac664bdb0e481539cf77098a7dd0e1ec8d937ba0 (diff)
parent193d137056c3c4f73d66f8db84691d63307de894 (diff)
Merge branch 'master' of github.com:redpony/cdec
Diffstat (limited to 'mteval/ns_cer.h')
-rw-r--r--mteval/ns_cer.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/mteval/ns_cer.h b/mteval/ns_cer.h
new file mode 100644
index 00000000..9d211181
--- /dev/null
+++ b/mteval/ns_cer.h
@@ -0,0 +1,23 @@
+#ifndef _NS_CER_H_
+#define _NS_CER_H_
+
+#include "ns.h"
+
+class CERMetric : public EvaluationMetric {
+ friend class EvaluationMetric;
+ private:
+ unsigned EditDistance(const std::string& hyp,
+ const std::string& ref) const;
+ protected:
+ CERMetric() : EvaluationMetric("CER") {}
+
+ public:
+ virtual bool IsErrorMetric() const;
+ virtual unsigned SufficientStatisticsVectorSize() const;
+ virtual void ComputeSufficientStatistics(const std::vector<WordID>& hyp,
+ const std::vector<std::vector<WordID> >& refs,
+ SufficientStats* out) const;
+ virtual float ComputeScore(const SufficientStats& stats) const;
+};
+
+#endif