typos
Browse files
gleu.py
CHANGED
@@ -159,12 +159,11 @@ class GLEU():
|
|
159 |
# smooth 0 counts for sentence-level scores
|
160 |
if smooth :
|
161 |
stats = [ s if s != 0 else 1 for s in stats ]
|
162 |
-
if len(filter(lambda x: x==0, stats)) > 0:
|
163 |
return 0
|
164 |
(c, r) = stats[:2]
|
165 |
-
log_gleu_prec = sum([
|
166 |
-
|
167 |
-
return math.exp(min([0, 1-float(r)/c]) + log_gleu_prec)
|
168 |
|
169 |
|
170 |
|
|
|
159 |
# smooth 0 counts for sentence-level scores
|
160 |
if smooth :
|
161 |
stats = [ s if s != 0 else 1 for s in stats ]
|
162 |
+
if len(list(filter(lambda x: x==0, stats))) > 0:
|
163 |
return 0
|
164 |
(c, r) = stats[:2]
|
165 |
+
log_gleu_prec = sum([log(float(x)/y) for x,y in zip(stats[2::2],stats[3::2])]) / 4
|
166 |
+
return exp(min([0, 1-float(r)/c]) + log_gleu_prec)
|
|
|
167 |
|
168 |
|
169 |
|