Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The language detection module takes into consideration only the first 30 second segment of the audio, disregarding that it may be silent, or too noisy. In such a scenario, the model may detect an arbitrary language. To overcome this problem, I propose an additional functionality that takes into consideration at least one audio segment and accepts the two following parameters:
The first parameter specifies how many segments of the audio to be taken into account (min: 1, max: full audio). The latter sets a threshold that if it is lower than the maximum probability of the language tokens, considers the language detected. If it fails to recognize the language for all the specified segments, because, either the max probability of all languages in the segments are lower than the threshold or the threshold is not specified (None), then perform a majority voting on the segment languages in order to decide the language.
The previous behavior, i.e. max probability of the first 30 seconds language tokens, is achieved by setting the parameters to: