Skip to navigation

nemo_curator.stages.audio.text_filtering.regex_substitution

View as Markdown

Module Contents

Classes

NameDescription
RegexSubstitutionStageApply an ordered YAML list of regex substitutions to one transcript field.

API

class nemo_curator.stages.audio.text_filtering.RegexSubstitutionStage(
regex_params_yaml: str = '',
text_key: str = 'pred_text',
output_text_key: str = 'text',
skip_me_key: str = '_skipme',
name: str = 'RegexSubstitution',
resources: nemo_curator.stages.resources.Resources = (lambda: Resources(cpus=1.0...
)
Dataclass

Bases: ProcessingStage[AudioTask, AudioTask]

Apply an ordered YAML list of regex substitutions to one transcript field.

The YAML document must be a list. Each rule must define string pattern and repl values and may define a non-negative integer count limit. Rules run in file order before whitespace is collapsed. Rows carrying an existing skip reason are not normalized. The empty-result skip is set only when cleaning removes non-whitespace input; already-empty input remains unskipped.

_rules
list[dict[str, Any]]
name
str = 'RegexSubstitution'
output_text_key
str = 'text'
regex_params_yaml
str = ''
resources
Resources
skip_me_key
str = '_skipme'
text_key
str = 'pred_text'
nemo_curator.stages.audio.text_filtering.RegexSubstitutionStage.__post_init__() -> None
nemo_curator.stages.audio.text_filtering.RegexSubstitutionStage.inputs() -> tuple[list[str], list[str]]
nemo_curator.stages.audio.text_filtering.RegexSubstitutionStage.outputs() -> tuple[list[str], list[str]]
nemo_curator.stages.audio.text_filtering.RegexSubstitutionStage.process(
nemo_curator.stages.audio.text_filtering.RegexSubstitutionStage.setup(
_worker_metadata: object | None = None
) -> None