Python Forum
Calculating BLEU scores in Python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Calculating BLEU scores in Python (/thread-31967.html)



Calculating BLEU scores in Python - kg17 - Jan-12-2021

Dear all,
Wondering if anyone has ever had any experience with calculating BLEU scores for evaluating machine translation quality?
I want to compare machine-translated text to a human translation reference and have found the code to calculate this here: https://github.com/vikasnar/Bleu
I have visual studio code, but I have absolutely no idea what I am doing and have absolutely no experience with programming. There is a test set on the code, but I cannot seem to figure out how to even input this or run this.
Is anyone able to help/offer a programming for dummies explanation of how to calculate this test set?
I would be very grateful!

Thanks in advance!


RE: Calculating BLEU scores in Python - Gribouillis - Jan-12-2021

If I understand well how the program works, you don't need any programming experience to use it as a black box:
  1. Create a file machine-translated.txt containing the machine translation of some text.
  2. Create a directory containing one or more human translations of the same text, say human-translated-1.txt, human-translated-2.txt etc.
  3. Run the command python calculatebleu.py machine-translated.txt path-to-directory
  4. Then read the contents of the new file bleu_output.txt