69e5a2d56cefd3774a5d4a4a6f77b0af3357a206,official/nlp/transformer/compute_bleu.py,,bleu_wrapper,#Any#Any#Any#,89

Before Change


        "lines (%d VS %d). If training only a few steps (100-200), the "
        "translation may be empty." % (len(ref_lines), len(hyp_lines)))
  if not case_sensitive:
    ref_lines = [x.lower() for x in ref_lines]
    hyp_lines = [x.lower() for x in hyp_lines]
  ref_tokens = [bleu_tokenize(x) for x in ref_lines]
  hyp_tokens = [bleu_tokenize(x) for x in hyp_lines]
  return metrics.compute_bleu(ref_tokens, hyp_tokens) * 100


def main(unused_argv):
  if FLAGS.bleu_variant in ("both", "uncased"):

After Change


      tf.io.gfile.GFile(ref_filename).read()).strip().splitlines()
  hyp_lines = tokenizer.native_to_unicode(
      tf.io.gfile.GFile(hyp_filename).read()).strip().splitlines()
  return bleu_on_list(ref_lines, hyp_lines, case_sensitive)


def bleu_on_list(ref_lines, hyp_lines, case_sensitive=False):
  Compute BLEU for two list of strings (reference and hypothesis).
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 15

Instances


Project Name: tensorflow/models
Commit Name: 69e5a2d56cefd3774a5d4a4a6f77b0af3357a206
Time: 2020-06-23
Author: gardener@tensorflow.org
File Name: official/nlp/transformer/compute_bleu.py
Class Name:
Method Name: bleu_wrapper


Project Name: tensorflow/models
Commit Name: ecf13b0e5f0d47d60b0eedb15e7944327969a1fb
Time: 2020-06-23
Author: gardener@tensorflow.org
File Name: official/nlp/transformer/compute_bleu.py
Class Name:
Method Name: bleu_wrapper


Project Name: bethgelab/foolbox
Commit Name: 80cfb0e5f889c65a972ebde6c6dae4278b5e28c1
Time: 2020-02-14
Author: git@jonasrauber.de
File Name: foolbox/attacks/base.py
Class Name: MinimizationAttack
Method Name: __call__