euroeval.metrics.sacrebleu¶
source module euroeval.metrics.sacrebleu
source class ChrF(word_order: int = 0, beta: int = 2, language_detector: LanguageDetector | None = None)
Bases : Metric
The ChrF metric.
Initialise the ChrF metric.
Parameters
-
word_order : optional — The word order for the ChrF metric. Defaults to 0, which is the original chrF metric. If set to 2, it is the chrF++ metric.
-
beta : optional — The beta parameter for the ChrF metric. Defaults to 2, which is the original chrF (and chrF++) metric.
-
language_detector : optional — A LanguageDetector instance. If provided, each per-sentence score is multiplied by a binary language penalty (1.0 if the prediction is in the correct language, 0.0 otherwise) before averaging. Defaults to None, which disables language penalization.
Methods
-
download — Download the language detection model if needed.
source method ChrF.download(cache_dir: str) → ChrF
Download the language detection model if needed.
Parameters
-
cache_dir : str — The directory where the metric will be downloaded to.
Returns
-
ChrF — The metric object itself.