harvardnlp / seq2seq-attn

Sequence-to-sequence model with LSTM encoder/decoders and attention
http://nlp.seas.harvard.edu/code
MIT License
1.26k stars 278 forks source link

how to use s2sa/scorers/bleu.lua #93

Closed IdiosyncraticDragon closed 7 years ago

IdiosyncraticDragon commented 7 years ago

I found it was not very convenient to use multi-bleu.perl to calculate BLEU score every time, especially when I wanted to get the BLEU score inside a lua program. I find there is a file called bleu.lua under s2sa/scorers/ which seems like a program to compute BLEU scores. Is there any usage for the bleu.lua?

yoonkim commented 7 years ago

Yes, get_ngram_prec basically calculates the ngram precisions, which you can use to get corpus level (or sentence level) bleu. See evaluate.lua with the scorer option to see how this is calc'ed at sentence level.