Skip to content

Commit

Permalink
Create gleu.py
Browse files Browse the repository at this point in the history
fix brevity penalty
  • Loading branch information
cnap authored Jun 9, 2017
1 parent 4f57590 commit 50b5032
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/gleu.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Courtney Napoles
# <courtneyn@jhu.edu>
# <napoles@cs.jhu.edu>
# 21 June 2015
# ##
# gleu.py
Expand All @@ -13,6 +13,8 @@
# Updated 2 May 2016: This is an updated version of GLEU that has been
# modified to handle multiple references more fairly.
#
# Updated 6 9 2017: Fixed inverse brevity penalty
#
# This script was adapted from bleu.py by Adam Lopez.
# <https://github.com/alopez/en600.468/blob/master/reranker/>

Expand Down Expand Up @@ -87,8 +89,8 @@ def gleu_stats(self,i,r_ind=None):
hlen = self.hlen
rlen = self.rlens[i][r_ind]

yield rlen
yield hlen
yield rlen

for n in xrange(1,self.order+1):
h_ngrams = self.this_h_ngrams[n-1]
Expand Down

0 comments on commit 50b5032

Please sign in to comment.