Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

How to get the BLEU value of the test corpus #361

Closed
yapingzhao opened this issue Jul 17, 2018 · 2 comments
Closed

How to get the BLEU value of the test corpus #361

yapingzhao opened this issue Jul 17, 2018 · 2 comments

Comments

@yapingzhao
Copy link

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!

@durson
Copy link

durson commented Jul 17, 2018

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'))

  2. Run it
    python3 -m nmt.eval_bleu <reference file> <translation file>

@yapingzhao
Copy link
Author

@durson Thank you very much.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants