janus.metrics.bleu#

Functions#

bleu(target, reference[, smooth_method, smooth_value, ...])

Computes BLEU score using sacrebleu

Module Contents#

janus.metrics.bleu.bleu(target, reference, smooth_method='exp', smooth_value=None, lowercase=False, use_effective_order=True, **kwargs)#

Computes BLEU score using sacrebleu

Parameters:
  • target (str) – The target text.

  • reference (str) – The reference text.

  • smooth_method (Annotated[str, typer.Option(click_type=click.Choice(['exp', 'floor', 'add-k', 'none']), help='Smoothing method to use.')]) – smoothing method to use.

  • smooth_value (Annotated[Optional[float], typer.Option(help="Smoothing value (only for 'floor' and 'add-k').")]) – smoothing value (only for floor and add-k).

  • lowercase (Annotated[bool, typer.Option(help='Whether to lowercase the data.')]) – whether to lowercase the data.

  • use_effective_order (Annotated[bool, typer.Option(help='Whether to use n-gram orders without matches.')]) – Don’t use n-gram orders without matches.

Returns:

The BLEU score float.

Return type:

float