summaryrefslogtreecommitdiff
path: root/python/src/mteval.pxi
diff options
context:
space:
mode:
authorVictor Chahuneau <vchahune@cs.cmu.edu>2012-08-11 23:30:00 -0400
committerVictor Chahuneau <vchahune@cs.cmu.edu>2012-08-11 23:30:00 -0400
commit7527592aaf4245749845500aca6a7fcc97eb2f17 (patch)
treed8fdb627c657e7a4699baf0670ca749df1f7e972 /python/src/mteval.pxi
parentdad8da6f5f65e157476b3999257069bda7b8552e (diff)
[python] fix for new dict API
- TDConvert returns a string - various c_str fixes (make copies) - cleanup .gitignore
Diffstat (limited to 'python/src/mteval.pxi')
-rw-r--r--python/src/mteval.pxi9
1 files changed, 4 insertions, 5 deletions
diff --git a/python/src/mteval.pxi b/python/src/mteval.pxi
index cd1c3c81..f1b6b5d1 100644
--- a/python/src/mteval.pxi
+++ b/python/src/mteval.pxi
@@ -36,7 +36,7 @@ cdef class SufficientStats:
property detail:
def __get__(self):
- return self.metric.DetailedScore(self.stats[0]).c_str()
+ return str(self.metric.DetailedScore(self.stats[0]).c_str())
def __len__(self):
return self.stats.size()
@@ -131,7 +131,6 @@ cdef class Scorer:
refs = [refs]
cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]()
cdef vector[WordID]* refv
- cdef bytes ref_str
for ref in refs:
refv = new vector[WordID]()
ConvertSentence(string(as_str(ref.strip())), refv)
@@ -146,7 +145,7 @@ cdef class Scorer:
return evaluator
def __str__(self):
- return self.name.c_str()
+ return str(self.name.c_str())
cdef float _compute_score(void* metric_, mteval.SufficientStats* stats):
cdef Metric metric = <Metric> metric_
@@ -164,8 +163,8 @@ cdef void _compute_sufficient_stats(void* metric_,
cdef list refs_ = []
cdef unsigned i
for i in range(refs.size()):
- refs_.append(refs[0][i].c_str())
- cdef list ss = metric.evaluate(hyp.c_str(), refs_)
+ refs_.append(str(refs[0][i].c_str()))
+ cdef list ss = metric.evaluate(str(hyp.c_str()), refs_)
out.fields.resize(len(ss))
for i in range(len(ss)):
out.fields[i] = ss[i]