Unverified Commit 8b18491b authored by guptapriya's avatar guptapriya Committed by GitHub
Browse files

transformer v2: fix gfile reading

parent bc557d14
......@@ -88,9 +88,9 @@ def bleu_tokenize(string):
def bleu_wrapper(ref_filename, hyp_filename, case_sensitive=False):
"""Compute BLEU for two files (reference and hypothesis translation)."""
ref_lines = tokenizer.native_to_unicode(
tf.gfile.Open(ref_filename, "r").read()).split("\n")
tf.io.gfile.GFile(ref_filename).read()).strip().splitlines()
hyp_lines = tokenizer.native_to_unicode(
tf.gfile.Open(hyp_filename, "r").read()).split("\n")
tf.io.gfile.GFile(hyp_filename).read()).strip().splitlines()
if len(ref_lines) != len(hyp_lines):
raise ValueError("Reference and translation files have different number of "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment