janus.metrics.chrf#

Functions#

chrf(target, reference[, n_char_order, n_word_order, beta])

Calculate the chrF Score using Torchmetrics.

Module Contents#

janus.metrics.chrf.chrf(target, reference, n_char_order=typer.Option(default=6, help='A character n-gram order. If n_char_order=6, the metrics refers to the official chrF/chrF++.'), n_word_order=typer.Option(default=2, help='A word n-gram order. If n_word_order=2, the metric refers to the official chrF++. If n_word_order=0, the metric is equivalent to the original ChrF.'), beta=typer.Option(default=2.0, help='Determines importance of recall w.r.t. precision. If beta=1, their importance is equal.'), **kwargs)#

Calculate the chrF Score using Torchmetrics.

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

  • reference (str) – The reference text.

  • n_char_order (int) – The character order.

  • n_word_order (int) – The word order.

  • beta (float) – The beta value.

Returns:

The chrF score.

Return type:

float