Skip to content
DeepForgeby svx
All problems
EasyNLPnlp-195

Silence Ratio

Problem

Return the fraction of frames whose energy is at or below threshold.

Return 0.0 for an empty frame list.

Hint

Frames at or below the threshold count as silence, matching the VAD convention.

Test cases

case 1
in: [[0.1,0.5,0.9],0.5]
expected: 0.6666666666666666
case 2
in: [[1],0]
expected: 0
case 3
in: [[],0.5]
expected: 0
case 4
in: [[0,0],0]
expected: 1
Starter codePython
def silence_ratio(energies, threshold):
    # Your code here
    pass

4 test cases · run your code against them in the editor