BLEU (Bilguel Evaluatiol Understudy) spree i a metric used te to assessate the quality of machine translation output by comparing it tot te one or more reference translations. This guide provides a step-by- step proces to calculate BLEU scores efficively.

Understanding BLEU Score

A BLEU skorpió-mutató egy gépi generáció, amely a matches human-népszavazásokat vizsgálja. A "overlap of n-grams" a candidate és a reference translations között, along with a brevity penalty to constage overshort translations.

1. lépés: Data előkészítése

Gather the candidate translation an d on e or more reference translations. Ensure all texts ares to kenized consistentli, splitting ententions into words or subwords units.

2. lépés: Számológép N- gram Precision

For each n- gram size (comply 1 to 4), count the numberr of n- grams in the candidate translation that also appaar in the reference translations. Divide tis count by the tota number of ngrams ithe candidate to obtain precisiogn scoren for each n- gram leavl.

3. lépés: Apply Brevity Penalty

A brevity penalty (BP) penalizes translations thait are shorteur than the reference. Calculate it a:

BP = 1 if candidate controlth mmt; reference length; otherwise, BP = e ^ {(1 - reference length / candidate length)}.

Step 4: Compute Final BLEU Score

Combine the n-gram precisions using geometric measn and multiply by the brevity penalty:

BLEU = BP * exp (average of log precisions for n = 1 to 4).

Adalékal-Tips

  • Use multiple reference translations s for better reasmation.
  • Ensure consicent tokenization across all texts.
  • Utilize extening tools or libraries for calculation, such as NLTK or SacreBLEU.