espnet2.text.cleaner.TextCleaner
Less than 1 minute
espnet2.text.cleaner.TextCleaner
class espnet2.text.cleaner.TextCleaner(cleaner_types: Collection[str] | None = None)
Bases: object
Text cleaner.
This class provides various text cleaning functionalities based on specified cleaner types. It supports different cleaning methods including tacotron, jaconv, Vietnamese, Korean, and whisper text normalization.
cleaner_types
A list of cleaner types to be applied.
Type: list
Parameters:cleaner_types (Optional *[*Collection *[*str ] ]) – A collection of cleaner types. If None, an empty list is used. It can also be a single string.
Returns: The cleaned text after applying the specified cleaners.
Return type: str
Raises:
- RuntimeError – If an unsupported cleaner type is specified or if the
- Vietnamese cleaner is requested but not available. –
Examples
>>> cleaner = TextCleaner("tacotron")
>>> cleaner("(Hello-World); & jr. & dr.")
'HELLO WORLD, AND JUNIOR AND DOCTOR'
NOTE
Make sure to install required dependencies for all cleaner types to work properly, especially for Vietnamese cleaning.