| 2492 | |
| 2493 | class S2TPreprocessor(CommonPreprocessor): |
| 2494 | def __init__( |
| 2495 | self, |
| 2496 | train: bool, |
| 2497 | token_type: Optional[str] = None, |
| 2498 | token_list: Union[Path, str, Iterable[str]] = None, |
| 2499 | bpemodel: Union[Path, str, Iterable[str]] = None, |
| 2500 | text_cleaner: Collection[str] = None, |
| 2501 | g2p_type: Optional[str] = None, |
| 2502 | unk_symbol: str = "<unk>", |
| 2503 | space_symbol: str = "<space>", |
| 2504 | non_linguistic_symbols: Union[Path, str, Iterable[str]] = None, |
| 2505 | delimiter: Optional[str] = None, |
| 2506 | rir_scp: Optional[str] = None, |
| 2507 | rir_apply_prob: float = 1.0, |
| 2508 | noise_scp: Optional[str] = None, |
| 2509 | noise_apply_prob: float = 1.0, |
| 2510 | noise_db_range: str = "3_10", |
| 2511 | short_noise_thres: float = 0.5, |
| 2512 | speech_volume_normalize: float = None, |
| 2513 | speech_name: str = "speech", |
| 2514 | text_name: str = "text", |
| 2515 | text_prev_name: str = "text_prev", |
| 2516 | text_ctc_name: str = "text_ctc", |
| 2517 | fs: int = 16000, |
| 2518 | na_symbol: str = "<na>", # text is not available e.g. for prev or ctc |
| 2519 | speech_length: float = 30, # pad or trim speech to this value in seconds |
| 2520 | speech_resolution: float = 0.02, # speech time resolution |
| 2521 | speech_init_silence: float = 1.0, # max silence before speech for data aug |
| 2522 | text_prev_apply_prob: float = 0.5, # whether to condition on text_prev |
| 2523 | time_apply_prob: float = 0.5, # whether to include timestamps |
| 2524 | notime_symbol: str = "<notimestamps>", |
| 2525 | first_time_symbol: str = "<0.00>", |
| 2526 | last_time_symbol: str = "<30.00>", |
| 2527 | ): |
| 2528 | super().__init__( |
| 2529 | train=train, |
| 2530 | token_type=token_type, |
| 2531 | token_list=token_list, |
| 2532 | bpemodel=bpemodel, |
| 2533 | text_cleaner=text_cleaner, |
| 2534 | g2p_type=g2p_type, |
| 2535 | unk_symbol=unk_symbol, |
| 2536 | space_symbol=space_symbol, |
| 2537 | non_linguistic_symbols=non_linguistic_symbols, |
| 2538 | delimiter=delimiter, |
| 2539 | rir_scp=rir_scp, |
| 2540 | rir_apply_prob=rir_apply_prob, |
| 2541 | noise_scp=noise_scp, |
| 2542 | noise_apply_prob=noise_apply_prob, |
| 2543 | noise_db_range=noise_db_range, |
| 2544 | short_noise_thres=short_noise_thres, |
| 2545 | speech_volume_normalize=speech_volume_normalize, |
| 2546 | speech_name=speech_name, |
| 2547 | text_name=text_name, |
| 2548 | fs=fs, |
| 2549 | ) |
| 2550 | self.text_prev_name = text_prev_name |
| 2551 | self.text_ctc_name = text_ctc_name |