Skip to navigation

nemo_curator.stages.audio.text_filtering.select_best_prediction

View as Markdown

Module Contents

Classes

NameDescription
SelectBestPredictionStageChoose one stable transcript from primary, recovery, or reference text.

Functions

Data

_PUNCTUATION

API

class nemo_curator.stages.audio.text_filtering.SelectBestPredictionStage(
primary_text_key: str = 'primary_model_prediction',
fallback_text_key: str = 'fallback_model_prediction',
asr_text_key: str | None = None,
output_key: str = 'best_prediction',
source_key: str = 'best_prediction_source',
notes_key: str = 'additional_notes',
skip_me_key: str = '_skipme',
duration_key: str = 'duration',
language_key: str = 'source_lang',
min_agreement_pct: float = 80.0,
agreement_wer_key: str = 'primary_fallback_agreement...,
metric_key: str = 'primary_fallback_agreement...,
primary_source_label: str = 'primary',
fallback_source_label: str = 'fallback',
reference_text_key: str | None = None,
use_reference_on_hallucination: bool = False,
force_reference: bool = False,
use_ground_truth_for_short_audio: bool = True,
short_audio_threshold: float = 1.0,
primary_model_type: str | None = None,
reference_source_label: str = 'reference',
ground_truth_source_label: str = 'ground_truth',
name: str = 'SelectBestPrediction',
resources: nemo_curator.stages.resources.Resources = (lambda: Resources(cpus=1.0...
)
Dataclass

Bases: ProcessingStage[AudioTask, AudioTask]

Choose one stable transcript from primary, recovery, or reference text.

Selection is ordered so explicit reference policies run before model recovery. Short Qwen-Omni clips can use reference text to avoid known sub-second hallucinations, and force_reference can make reference text authoritative for datasets whose model output is not trusted. Otherwise, the stage handles unsupported languages, recovered fallback predictions, reference recovery, cross-model agreement, and the normal primary result. Cross-model agreement uses character error rate (CER) for languages written without word-separating spaces and word error rate (WER) otherwise. The selected metric is recorded in metric_key. asr_text_key is a compatibility alias that overrides fallback_text_key when supplied.

agreement_wer_key
str = 'primary_fallback_agreement_wer'
asr_text_key
str | None = None
duration_key
str = 'duration'
fallback_source_label
str = 'fallback'
fallback_text_key
str = 'fallback_model_prediction'
force_reference
bool = False
ground_truth_source_label
str = 'ground_truth'
language_key
str = 'source_lang'
metric_key
str = 'primary_fallback_agreement_metric'
min_agreement_pct
float = 80.0
name
str = 'SelectBestPrediction'
notes_key
str = 'additional_notes'
output_key
str = 'best_prediction'
primary_model_type
str | None = None
primary_source_label
str = 'primary'
primary_text_key
str = 'primary_model_prediction'
reference_source_label
str = 'reference'
reference_text_key
str | None = None
resources
Resources
short_audio_threshold
float = 1.0
skip_me_key
str = '_skipme'
source_key
str = 'best_prediction_source'
use_ground_truth_for_short_audio
bool = True
use_reference_on_hallucination
bool = False
nemo_curator.stages.audio.text_filtering.SelectBestPredictionStage.inputs() -> tuple[list[str], list[str]]
nemo_curator.stages.audio.text_filtering.SelectBestPredictionStage.outputs() -> tuple[list[str], list[str]]
nemo_curator.stages.audio.text_filtering.SelectBestPredictionStage.process(
nemo_curator.stages.audio.text_filtering.select_best_prediction._normalize_for_error_rate(
text: str
) -> str
nemo_curator.stages.audio.text_filtering.select_best_prediction._set_note(
data: dict[str, typing.Any],
stage: str,
value: str,
notes_key: str
) -> None
nemo_curator.stages.audio.text_filtering.select_best_prediction._PUNCTUATION = re.compile('[^\\w\\s]', re.UNICODE)