pytorch_lightning.metrics.nlp module¶
-
class
pytorch_lightning.metrics.nlp.
BLEUScore
(n_gram=4, smooth=False)[source]¶ Bases:
pytorch_lightning.metrics.metric.Metric
Calculate BLEU score of machine translated text with one or more references.
Example
>>> translate_corpus = ['the cat is on the mat'.split()] >>> reference_corpus = [['there is a cat on the mat'.split(), 'a cat is on the mat'.split()]] >>> metric = BLEUScore() >>> metric(translate_corpus, reference_corpus) tensor(0.7598)
- Parameters