order moved
Browse files
gleu.py
CHANGED
@@ -73,7 +73,9 @@ Examples:
|
|
73 |
BAD_WORDS_URL = "http://url/to/external/resource/bad_words.txt"
|
74 |
|
75 |
class GLEU():
|
76 |
-
|
|
|
|
|
77 |
def load_hypothesis_sentence(self,hypothesis) :
|
78 |
self.hlen = len(hypothesis)
|
79 |
self.this_h_ngrams = [ self.get_ngram_counts(hypothesis,n)
|
@@ -192,9 +194,6 @@ class gleu(evaluate.Metric):
|
|
192 |
"""Optional: download external resources useful to compute the scores"""
|
193 |
# TODO: Download external resources if needed
|
194 |
pass
|
195 |
-
|
196 |
-
def __init__(self, order=4) :
|
197 |
-
self.order = order
|
198 |
|
199 |
def _compute(self, references, predictions):
|
200 |
"""Returns the scores"""
|
@@ -204,7 +203,7 @@ class gleu(evaluate.Metric):
|
|
204 |
if len(references)==1:
|
205 |
num_iterations = 1
|
206 |
|
207 |
-
gleu_calculator = GLEU(
|
208 |
|
209 |
# if sources:
|
210 |
# gleu_calculator.load_sources(sources)
|
|
|
73 |
BAD_WORDS_URL = "http://url/to/external/resource/bad_words.txt"
|
74 |
|
75 |
class GLEU():
|
76 |
+
def __init__(self, order=4) :
|
77 |
+
self.order = order
|
78 |
+
|
79 |
def load_hypothesis_sentence(self,hypothesis) :
|
80 |
self.hlen = len(hypothesis)
|
81 |
self.this_h_ngrams = [ self.get_ngram_counts(hypothesis,n)
|
|
|
194 |
"""Optional: download external resources useful to compute the scores"""
|
195 |
# TODO: Download external resources if needed
|
196 |
pass
|
|
|
|
|
|
|
197 |
|
198 |
def _compute(self, references, predictions):
|
199 |
"""Returns the scores"""
|
|
|
203 |
if len(references)==1:
|
204 |
num_iterations = 1
|
205 |
|
206 |
+
gleu_calculator = GLEU(order=4)
|
207 |
|
208 |
# if sources:
|
209 |
# gleu_calculator.load_sources(sources)
|