Nmt: How to get the BLEU value of the test corpus

Created on 17 Jul 2018  路  2Comments  路  Source: tensorflow/nmt

Hi,
python -m nmt.nmt \
--out_dir=/tmp/nmt_model \
--inference_input_file=/tmp/my_infer_file.vi \
--inference_output_file=/tmp/nmt_model/output_infer
--vocab_prefix=/tmp/vocab
Run the above command to get the translated translation, but there is no BLEU value, how to get the BLEU value, what is the command?

Looking forward to your advice or answers.
Best regards,
Thank you very much!

Most helpful comment

Hello, in my project I did it in a following way:

  1. Create script named nmt/eval_bleu.py
    from .utils import evaluation_utils
    import sys
    ref = sys.argv[1]
    hyp = sys.argv[2]
    print(evaluation_utils.evaluate(ref, hyp, 'bleu'))
  1. Run it
    python3 -m nmt.eval_bleu <reference file> <translation file>

All 2 comments

Hello, in my project I did it in a following way:

  1. Create script named nmt/eval_bleu.py
    from .utils import evaluation_utils
    import sys
    ref = sys.argv[1]
    hyp = sys.argv[2]
    print(evaluation_utils.evaluate(ref, hyp, 'bleu'))
  1. Run it
    python3 -m nmt.eval_bleu <reference file> <translation file>

@durson Thank you very much.

Was this page helpful?
0 / 5 - 0 ratings