nlpstack.common.bleu module#
- class nlpstack.common.bleu.BLEU(ngram_weights=(0.25, 0.25, 0.25, 0.25), exclude_tokens=None)[source]#
Bases:
objectCalculate BLEU score.
This class can be used to calculate BLEU score between two sequences of tokens. The implementation is based on the following paper:
https://api.semanticscholar.org/CorpusID:11080756?utm_source=wikipedia
- Parameters:
ngram_weights (
Sequence[float]) – A list of ngram weights.exclude_tokens (Set[Token] | None) –