espnet2.asr_transducer.utils.check_short_utt
Less than 1 minute
espnet2.asr_transducer.utils.check_short_utt
espnet2.asr_transducer.utils.check_short_utt(sub_factor: int, size: int) → Tuple[bool, int]
Check if the input is too short for subsampling.
This function evaluates whether the input size is adequate for the given subsampling factor. If the input size is shorter than the required length for the specified subsampling factor, it returns an error indication along with the minimum size limit for that factor.
- Parameters:
- sub_factor – Subsampling factor for Conv2DSubsampling.
- size – Input size.
- Returns: A tuple where the first element indicates whether an error should be sent (True if the size is too short, otherwise False), and the second element is the size limit for the specified subsampling factor. A return value of -1 indicates no limit.
- Return type: Tuple[bool, int]
Examples
>>> check_short_utt(2, 2)
(True, 7)
>>> check_short_utt(4, 6)
(True, 7)
>>> check_short_utt(6, 12)
(False, -1)
NOTE
The size limits for each subsampling factor are as follows:
- For sub_factor 2, size must be at least 3.
- For sub_factor 4, size must be at least 7.
- For sub_factor 6, size must be at least 11.