speaker_helper.eval.dataset module
Evaluation datasets: reference utterances the engine must speak well.
Module summary
An evaluation is only reproducible if the inputs are versioned alongside the
code. This module defines EvalCase (one reference utterance) and loads
JSON Lines datasets — the built-in French set data/fr_reference.jsonl ships
in the package, and callers may point at their own file.
Each line is a JSON object with id, language, text and, optionally,
a reference transcript to score a re-transcription round-trip against
(defaulting to text itself).
Usage example
>>> from speaker_helper.eval.dataset import load_dataset
>>> cases = load_dataset() # the built-in French set
>>> cases[0].language
'fr'
- class speaker_helper.eval.dataset.EvalCase(id, text, language='fr', reference='')[source]
Bases:
objectOne reference utterance to synthesise and score.
- Parameters:
- speaker_helper.eval.dataset.available_languages()[source]
Return the sorted language codes that ship a built-in dataset.
- speaker_helper.eval.dataset.dataset_path_for_language(language)[source]
Return the bundled dataset path for a language code (e.g.
"en").
- speaker_helper.eval.dataset.load_dataset(path=None, *, language=None)[source]
Load evaluation cases from a JSON Lines file.
- Parameters:
- Returns:
The cases in file order.
- Return type:
- Raises:
FileNotFoundError – If the resolved dataset does not exist (the error lists the languages that do ship a dataset).
ValueError – If a line is not valid JSON or lacks the required
id/textkeys.