summaryrefslogtreecommitdiff
path: root/python/src/mteval.pxd
diff options
context:
space:
mode:
authorVictor Chahuneau <vchahune@cs.cmu.edu>2012-07-01 00:38:30 -0400
committerVictor Chahuneau <vchahune@cs.cmu.edu>2012-07-01 00:38:30 -0400
commitdc9e428224d95adf63da6460a2031348de295ca1 (patch)
tree5f7b9022f75d67d8cc8b069b6e8164978b93ff93 /python/src/mteval.pxd
parent3044d6d1c6d428e8d06c255e3a2d739bcd187679 (diff)
[python] MT evaluation
Diffstat (limited to 'python/src/mteval.pxd')
-rw-r--r--python/src/mteval.pxd47
1 files changed, 47 insertions, 0 deletions
diff --git a/python/src/mteval.pxd b/python/src/mteval.pxd
new file mode 100644
index 00000000..52af6297
--- /dev/null
+++ b/python/src/mteval.pxd
@@ -0,0 +1,47 @@
+from libcpp.vector cimport vector
+from libcpp.string cimport string
+from utils cimport *
+from hypergraph cimport Hypergraph
+
+cdef extern from "mteval/ns.h":
+ cdef cppclass SufficientStats:
+ SufficientStats()
+ SufficientStats(SufficientStats&)
+ unsigned size()
+ float operator[](unsigned i)
+ void swap(SufficientStats& other)
+
+ SufficientStats add "operator+" (SufficientStats&, SufficientStats&)
+
+ cdef cppclass SegmentEvaluator:
+ void Evaluate(vector[WordID]& hyp, SufficientStats* out)
+
+ cdef cppclass EvaluationMetric:
+ string& MetricId()
+ bint IsErrorMetric()
+ float ComputeScore(SufficientStats& stats)
+ string DetailedScore(SufficientStats& stats)
+ shared_ptr[SegmentEvaluator] CreateSegmentEvaluator(vector[vector[WordID]]& refs)
+ ComputeSufficientStatistics(vector[WordID]& hyp,
+ vector[WordID]& refs,
+ SufficientStats* out)
+
+cdef extern from "mteval/ns.h" namespace "EvaluationMetric":
+ EvaluationMetric* Instance(string& metric_id)
+ EvaluationMetric* Instance() # IBM_BLEU
+
+cdef extern from "training/candidate_set.h" namespace "training":
+ cdef cppclass Candidate "const training::Candidate":
+ vector[WordID] ewords
+ FastSparseVector[weight_t] fmap
+ SufficientStats eval_feats
+
+ cdef cppclass CandidateSet:
+ CandidateSet()
+ unsigned size()
+ Candidate& operator[](unsigned i)
+ void ReadFromFile(string& file)
+ void WriteToFile(string& file)
+ void AddKBestCandidates(Hypergraph& hg,
+ unsigned kbest_size,
+ SegmentEvaluator* scorer)