summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Chahuneau <vchahune@cs.cmu.edu>2012-07-25 23:57:05 -0400
committerVictor Chahuneau <vchahune@cs.cmu.edu>2012-07-25 23:57:05 -0400
commit0ee6610cf1c0ab342e438879b8a5fe4046e33189 (patch)
tree2cc2c8b8363554a442d9c76dc984f13621ac1dd1
parent070e7fbbacd70dd916a95c1ab08b0113ec221c30 (diff)
Character error rate metric
- [python] cdec.score.CER - Cleanup .gitignore
-rw-r--r--.gitignore89
-rw-r--r--mteval/Jamfile2
-rw-r--r--mteval/Makefile.am2
-rw-r--r--mteval/ns.cc3
-rw-r--r--mteval/ns_cer.cc55
-rw-r--r--mteval/ns_cer.h23
-rw-r--r--python/cdec/score.py2
-rw-r--r--python/src/_cdec.cpp58
-rw-r--r--python/src/mteval.pxi1
9 files changed, 147 insertions, 88 deletions
diff --git a/.gitignore b/.gitignore
index 943e6dc5..571360ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,19 @@
+*.log
+*.bbl
+*.aux
+*.blg
+*.idx
+*.pdf
+*.dvi
+*.ps
+*.toc
+*.so
+*.pyc
+*swp
+*.o
+*.a
+*~
+.*
./cdec/
decoder/bin/
gi/pf/align-tl
@@ -6,21 +22,17 @@ gi/pf/nuisance_test
gi/pf/pf_test
gi/pf/pyp_lm
jam-files/bjam
-jam-files/engine/bin.linuxx86_64/
+jam-files/engine/bin.*
jam-files/engine/bootstrap/
klm/lm/bin/
-klm/lm/libkenlm.so
-klm/lm/libkenutil.so
klm/lm/query
klm/util/bin/
mteval/bin/
rampion/rampion_cccp
-rst_parser/librst.a
rst_parser/mst_train
rst_parser/rst_parse
rst_parser/rst_train
training/liblbfgs/bin/
-training/liblbfgs/liblbfgs.a
training/liblbfgs/ll_test
utils/atools
utils/bin/
@@ -28,38 +40,18 @@ utils/crp_test
mira/kbest_mira
utils/m_test
sa-extract/calignment.c
-sa-extract/calignment.so
sa-extract/cdat.c
-sa-extract/cdat.so
sa-extract/cfloatlist.c
-sa-extract/cfloatlist.so
sa-extract/cintlist.c
-sa-extract/cintlist.so
sa-extract/clex.c
-sa-extract/clex.so
-sa-extract/cn.pyc
-sa-extract/context_model.pyc
sa-extract/cstrmap.c
-sa-extract/cstrmap.so
sa-extract/csuf.c
-sa-extract/csuf.so
sa-extract/cveb.c
-sa-extract/cveb.so
sa-extract/lcp.c
-sa-extract/lcp.so
-sa-extract/log.pyc
-sa-extract/manager.pyc
-sa-extract/model.pyc
-sa-extract/monitor.pyc
sa-extract/precomputation.c
-sa-extract/precomputation.so
sa-extract/rule.c
-sa-extract/rule.so
sa-extract/rulefactory.c
-sa-extract/rulefactory.so
-sa-extract/sgml.pyc
sa-extract/sym.c
-sa-extract/sym.so
training/lbl_model
training/mpi_flex_optimize
training/test_ngram
@@ -70,11 +62,9 @@ utils/phmt
utils/small_vector_test
utils/ts
utils/weights_test
-pro-train/.deps
pro-train/mr_pro_map
pro-train/mr_pro_reduce
utils/reconstruct_weights
-decoder/.libs
training/augment_grammar
training/mpi_batch_optimize
training/mpi_compute_cllh
@@ -83,34 +73,21 @@ training/mpi_extract_features
training/mpi_extract_reachable
klm/lm/build_binary
extools/extractor_monolingual
-gi/pf/.deps
gi/pf/learn_cfg
gi/pf/brat
gi/pf/cbgi
gi/pf/dpnaive
gi/pf/itg
-gi/pf/libpf.a
gi/pf/pfbrat
gi/pf/pfdist
gi/pf/pfnaive
-gi/markov_al/.deps
gi/markov_al/ml
gi/posterior-regularisation/prjava/lib/*.jar
-klm/lm/libklm.a
-klm/util/.deps
-klm/util/libklm_util.a
-mteval/.deps/
tests/system_tests/hmm/foo.src
training/cllh_filter_grammar
-klm/lm/.deps
mteval/fast_score
-mteval/libmteval.a
mteval/mbr_kbest
training/mpi_online_optimize
-utils/.deps/
-utils/libutils.a
-*swp
-*.o
dpmert/sentserver
dpmert/sentclient
gi/pyp-topics/src/contexts_lexer.cc
@@ -128,7 +105,6 @@ decoder/rule_lexer.cc
training/atools
training/collapse_weights
training/lbfgs_test
-training/libtraining.a
training/mr_optimize_reduce
training/mr_em_adapted_reduce
training/mr_em_map_adapter
@@ -141,6 +117,7 @@ dpmert/mr_dpmert_map
dpmert/mr_dpmert_reduce
dpmert/scorer_test
dpmert/union_forests
+minrisk/minrisk_optimize
Makefile
Makefile.in
aclocal.m4
@@ -153,48 +130,29 @@ configure
depcomp
install-sh
missing
-extools/.deps/
-extools/*.o
extools/extractor
extools/mr_stripe_rule_reduce
-decoder/.deps/
-decoder/*.o
decoder/Makefile
decoder/Makefile.in
decoder/cdec
decoder/dict_test
-decoder/libcdec.a
decoder/trule_test
decoder/weights_test
stamp-h1
-training/.deps/
training/Makefile
training/Makefile.in
-training/*.o
training/grammar_convert
training/model1
-dpmert/.deps/
dpmert/Makefile
dpmert/Makefile.in
dpmert/mr_dpmert_generate_mapper_input
-dpmert/*.o
decoder/logval_test
dtrain/dtrain
-dtrain/*.o
extools/build_lexical_translation
extools/filter_grammar
extools/score_grammar
-gi/clda/src/.deps/
gi/clda/src/clda
-gi/clda/src/clda.o
-gi/pyp-topics/src/.deps/
-gi/pyp-topics/src/corpus.o
-gi/pyp-topics/src/gammadist.o
-gi/pyp-topics/src/gzstream.o
-gi/pyp-topics/src/mt19937ar.o
gi/pyp-topics/src/pyp-topics-train
-gi/pyp-topics/src/pyp-topics.o
-gi/pyp-topics/src/train.o
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
@@ -208,22 +166,11 @@ gi/posterior-regularisation/prjava/prjava.jar
gi/pyp-topics/src/pyp-contexts-train
extools/sg_lexer.cc
gi/posterior-regularisation/prjava/lib/prjava-20100715.jar
-*.log
-*.bbl
-*.aux
-*.blg
-*.idx
-*.pdf
-*.dvi
-*.ps
-*.toc
-*~
gi/pf/align-lexonly
gi/pf/align-lexonly-pyp
gi/pf/condnaive
mteval/scorer_test
phrasinator/gibbs_train_plm
phrasinator/gibbs_train_plm_notables
-.*
previous.sh
dist
diff --git a/mteval/Jamfile b/mteval/Jamfile
index 6260caea..3ed2c2cc 100644
--- a/mteval/Jamfile
+++ b/mteval/Jamfile
@@ -1,6 +1,6 @@
import testing ;
-lib mteval : ter.cc comb_scorer.cc aer_scorer.cc scorer.cc external_scorer.cc ns.cc ns_ter.cc ns_ext.cc ns_comb.cc ns_docscorer.cc ..//utils : <include>. : : <include>. <library>..//z ;
+lib mteval : ter.cc comb_scorer.cc aer_scorer.cc scorer.cc external_scorer.cc ns.cc ns_ter.cc ns_ext.cc ns_comb.cc ns_docscorer.cc ns_cer.cc ..//utils : <include>. : : <include>. <library>..//z ;
exe fast_score : fast_score.cc mteval ..//utils ..//boost_program_options ;
exe mbr_kbest : mbr_kbest.cc mteval ..//utils ..//boost_program_options ;
alias programs : fast_score mbr_kbest ;
diff --git a/mteval/Makefile.am b/mteval/Makefile.am
index 8d844e24..22550c99 100644
--- a/mteval/Makefile.am
+++ b/mteval/Makefile.am
@@ -8,7 +8,7 @@ TESTS = scorer_test
noinst_LIBRARIES = libmteval.a
-libmteval_a_SOURCES = ter.cc comb_scorer.cc aer_scorer.cc scorer.cc external_scorer.cc ns.cc ns_ter.cc ns_ext.cc ns_comb.cc ns_docscorer.cc
+libmteval_a_SOURCES = ter.cc comb_scorer.cc aer_scorer.cc scorer.cc external_scorer.cc ns.cc ns_ter.cc ns_ext.cc ns_comb.cc ns_docscorer.cc ns_cer.cc
fast_score_SOURCES = fast_score.cc
fast_score_LDADD = libmteval.a $(top_srcdir)/utils/libutils.a -lz
diff --git a/mteval/ns.cc b/mteval/ns.cc
index 8d354677..33952da7 100644
--- a/mteval/ns.cc
+++ b/mteval/ns.cc
@@ -2,6 +2,7 @@
#include "ns_ter.h"
#include "ns_ext.h"
#include "ns_comb.h"
+#include "ns_cer.h"
#include <cstdio>
#include <cassert>
@@ -254,6 +255,8 @@ EvaluationMetric* EvaluationMetric::Instance(const string& imetric_id) {
m = new ExternalMetric("METEOR", "java -Xmx1536m -jar /Users/cdyer/software/meteor/meteor-1.3.jar - - -mira -lower -t tune -l en");
} else if (metric_id.find("COMB:") == 0) {
m = new CombinationMetric(metric_id);
+ } else if (metric_id == "CER") {
+ m = new CERMetric;
} else {
cerr << "Implement please: " << metric_id << endl;
abort();
diff --git a/mteval/ns_cer.cc b/mteval/ns_cer.cc
new file mode 100644
index 00000000..a843d471
--- /dev/null
+++ b/mteval/ns_cer.cc
@@ -0,0 +1,55 @@
+#include "ns_cer.h"
+#include "tdict.h"
+
+static const unsigned kNUMFIELDS = 2;
+static const unsigned kEDITDISTANCE = 0;
+static const unsigned kCHARCOUNT = 1;
+
+bool CERMetric::IsErrorMetric() const {
+ return true;
+}
+
+unsigned CERMetric::SufficientStatisticsVectorSize() const {
+ return 2;
+}
+
+unsigned CERMetric::EditDistance(const std::string& hyp,
+ const std::string& ref) const {
+ const unsigned m = hyp.size(), n = ref.size();
+ std::vector<unsigned> edit((m + 1) * 2);
+ for(unsigned i = 0; i < n + 1; i++) {
+ for(unsigned j = 0; j < m + 1; j++) {
+ if(i == 0)
+ edit[j] = j;
+ else if(j == 0)
+ edit[(i%2)*(m+1)] = i;
+ else
+ edit[(i%2)*(m+1) + j] = std::min(std::min(edit[(i%2)*(m+1) + j-1] + 1,
+ edit[((i-1)%2)*(m+1) + j] + 1),
+ edit[((i-1)%2)*(m+1) + (j-1)]
+ + (hyp[j-1] == ref[i-1] ? 0 : 1));
+
+ }
+ }
+ return edit[(n%2)*(m+1) + m];
+}
+
+void CERMetric::ComputeSufficientStatistics(const std::vector<WordID>& hyp,
+ const std::vector<std::vector<WordID> >& refs,
+ SufficientStats* out) const {
+ out->fields.resize(kNUMFIELDS);
+ std::string hyp_str(TD::GetString(hyp));
+ float best_score = hyp_str.size();
+ for (size_t i = 0; i < refs.size(); ++i) {
+ std::string ref_str(TD::GetString(refs[i]));
+ float score = EditDistance(hyp_str, ref_str);
+ if (score < best_score) {
+ out->fields[kEDITDISTANCE] = score;
+ out->fields[kCHARCOUNT] = ref_str.size();
+ best_score = score;
+ }
+ }
+}
+float CERMetric::ComputeScore(const SufficientStats& stats) const {
+ return stats.fields[kEDITDISTANCE] / stats.fields[kCHARCOUNT];
+}
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
diff --git a/python/cdec/score.py b/python/cdec/score.py
index d9486ef2..22257774 100644
--- a/python/cdec/score.py
+++ b/python/cdec/score.py
@@ -1 +1 @@
-from _cdec import BLEU, TER, Metric
+from _cdec import BLEU, TER, CER, Metric
diff --git a/python/src/_cdec.cpp b/python/src/_cdec.cpp
index 6d704b1d..44cd6568 100644
--- a/python/src/_cdec.cpp
+++ b/python/src/_cdec.cpp
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.16 on Mon Jul 23 19:56:55 2012 */
+/* Generated by Cython 0.16 on Wed Jul 25 23:56:10 2012 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -1761,13 +1761,14 @@ static char __pyx_k_49[] = "cannot initialize weights with %s";
static char __pyx_k_50[] = "#";
static char __pyx_k_53[] = "Cannot translate input type %s";
static char __pyx_k_56[] = "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi";
-static char __pyx_k_61[] = "/Users/vchahun/Sandbox/cdec/python/src/_cdec.pyx";
+static char __pyx_k_62[] = "/Users/vchahun/Sandbox/cdec/python/src/_cdec.pyx";
static char __pyx_k__a[] = "a";
static char __pyx_k__e[] = "e";
static char __pyx_k__f[] = "f";
static char __pyx_k__i[] = "i";
static char __pyx_k__k[] = "k";
static char __pyx_k__pb[] = "pb";
+static char __pyx_k__CER[] = "CER";
static char __pyx_k__TER[] = "TER";
static char __pyx_k__cat[] = "cat";
static char __pyx_k__dot[] = "dot";
@@ -1874,11 +1875,12 @@ static PyObject *__pyx_kp_s_49;
static PyObject *__pyx_kp_s_50;
static PyObject *__pyx_kp_s_53;
static PyObject *__pyx_kp_s_56;
-static PyObject *__pyx_kp_s_61;
+static PyObject *__pyx_kp_s_62;
static PyObject *__pyx_kp_s_7;
static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_kp_s_9;
static PyObject *__pyx_n_s__BLEU;
+static PyObject *__pyx_n_s__CER;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__IBM_BLEU;
static PyObject *__pyx_n_s__IndexError;
@@ -1982,9 +1984,10 @@ static PyObject *__pyx_k_tuple_54;
static PyObject *__pyx_k_tuple_57;
static PyObject *__pyx_k_tuple_58;
static PyObject *__pyx_k_tuple_59;
+static PyObject *__pyx_k_tuple_60;
static PyObject *__pyx_k_codeobj_37;
static PyObject *__pyx_k_codeobj_55;
-static PyObject *__pyx_k_codeobj_60;
+static PyObject *__pyx_k_codeobj_61;
/* "_cdec.pyx":6
* cimport decoder
@@ -26164,11 +26167,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
{&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0},
{&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0},
- {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0},
+ {&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0},
{&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
{&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
{&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
{&__pyx_n_s__BLEU, __pyx_k__BLEU, sizeof(__pyx_k__BLEU), 0, 0, 1, 1},
+ {&__pyx_n_s__CER, __pyx_k__CER, sizeof(__pyx_k__CER), 0, 0, 1, 1},
{&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
{&__pyx_n_s__IBM_BLEU, __pyx_k__IBM_BLEU, sizeof(__pyx_k__IBM_BLEU), 0, 0, 1, 1},
{&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1},
@@ -26565,6 +26569,7 @@ static int __Pyx_InitCachedConstants(void) {
*
* BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<<
* TER = Scorer('TER')
+ * CER = Scorer('CER')
*/
__pyx_k_tuple_57 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_57);
@@ -26577,6 +26582,7 @@ static int __Pyx_InitCachedConstants(void) {
*
* BLEU = Scorer('IBM_BLEU')
* TER = Scorer('TER') # <<<<<<<<<<<<<<
+ * CER = Scorer('CER')
*/
__pyx_k_tuple_58 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_58);
@@ -26585,6 +26591,18 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__TER));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":192
+ * BLEU = Scorer('IBM_BLEU')
+ * TER = Scorer('TER')
+ * CER = Scorer('CER') # <<<<<<<<<<<<<<
+ */
+ __pyx_k_tuple_59 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_59);
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__CER));
+ PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, ((PyObject *)__pyx_n_s__CER));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CER));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
+
/* "_cdec.pyx":28
* class ParseFailed(Exception): pass
*
@@ -26592,25 +26610,25 @@ static int __Pyx_InitCachedConstants(void) {
* for key, value in config.items():
* if isinstance(value, dict):
*/
- __pyx_k_tuple_59 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_59);
+ __pyx_k_tuple_60 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_60);
__Pyx_INCREF(((PyObject *)__pyx_n_s__config));
- PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, ((PyObject *)__pyx_n_s__config));
+ PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_n_s__config));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__config));
__Pyx_INCREF(((PyObject *)__pyx_n_s__key));
- PyTuple_SET_ITEM(__pyx_k_tuple_59, 1, ((PyObject *)__pyx_n_s__key));
+ PyTuple_SET_ITEM(__pyx_k_tuple_60, 1, ((PyObject *)__pyx_n_s__key));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__key));
__Pyx_INCREF(((PyObject *)__pyx_n_s__value));
- PyTuple_SET_ITEM(__pyx_k_tuple_59, 2, ((PyObject *)__pyx_n_s__value));
+ PyTuple_SET_ITEM(__pyx_k_tuple_60, 2, ((PyObject *)__pyx_n_s__value));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__value));
__Pyx_INCREF(((PyObject *)__pyx_n_s__name));
- PyTuple_SET_ITEM(__pyx_k_tuple_59, 3, ((PyObject *)__pyx_n_s__name));
+ PyTuple_SET_ITEM(__pyx_k_tuple_60, 3, ((PyObject *)__pyx_n_s__name));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__name));
__Pyx_INCREF(((PyObject *)__pyx_n_s__info));
- PyTuple_SET_ITEM(__pyx_k_tuple_59, 4, ((PyObject *)__pyx_n_s__info));
+ PyTuple_SET_ITEM(__pyx_k_tuple_60, 4, ((PyObject *)__pyx_n_s__info));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__info));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
- __pyx_k_codeobj_60 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_61, __pyx_n_s___make_config, 28, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
+ __pyx_k_codeobj_61 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_62, __pyx_n_s___make_config, 28, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
@@ -26831,6 +26849,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
*
* BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<<
* TER = Scorer('TER')
+ * CER = Scorer('CER')
*/
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
@@ -26841,12 +26860,23 @@ PyMODINIT_FUNC PyInit__cdec(void)
*
* BLEU = Scorer('IBM_BLEU')
* TER = Scorer('TER') # <<<<<<<<<<<<<<
+ * CER = Scorer('CER')
*/
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":192
+ * BLEU = Scorer('IBM_BLEU')
+ * TER = Scorer('TER')
+ * CER = Scorer('CER') # <<<<<<<<<<<<<<
+ */
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
/* "_cdec.pyx":22
* include "mteval.pxi"
*
diff --git a/python/src/mteval.pxi b/python/src/mteval.pxi
index f67f4f04..52d2abc6 100644
--- a/python/src/mteval.pxi
+++ b/python/src/mteval.pxi
@@ -189,3 +189,4 @@ cdef class Metric:
BLEU = Scorer('IBM_BLEU')
TER = Scorer('TER')
+CER = Scorer('CER')