mirror of
https://github.com/ggml-org/whisper.cpp.git
synced 2026-08-03 16:40:49 -05:00
* Bump version * Add test for VAD segments API * Implement VAD segments API * Add signatures of VAD segments API * Stop to dependent on mutex_m * Check segment range for vad_segment_t0/t1 * Remove needless check * Remove dead codes * Fix index check for VAD segments * Remove needless line * Use NUM2DBL instead of RFLOAT_VALUE for safety * Fix document * Check type of samples * Arrange CMake cache notation for older version * Remove unnecessary line break * Check return value of whisper_vad_segments_from_samples * Fix type of VAD::Segment#start_time and #end_time * Prevent dangling pointer from Params to VAD::Params * Fix typos * Update README * Make test follow fix of impl * Use segments_from_samples_body in ruby_whisper_vad_detect * Run segments_from_samples without GVL * Remove unnecessary codes * [skip ci]Remove trailing whitespace Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com> --------- Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
29 lines
761 B
Ruby
29 lines
761 B
Ruby
require_relative "helper"
|
|
|
|
class TestVAD < TestBase
|
|
def setup
|
|
@whisper = Whisper::Context.new("base.en")
|
|
vad_params = Whisper::VAD::Params.new
|
|
@params = Whisper::Params.new(
|
|
vad: true,
|
|
vad_model_path: "silero-v6.2.0",
|
|
vad_params:
|
|
)
|
|
end
|
|
|
|
def test_transcribe
|
|
@whisper.transcribe(TestBase::AUDIO, @params) do |text|
|
|
assert_match(/ask not what your country can do for you[,.] ask what you can do for your country/i, text)
|
|
end
|
|
end
|
|
|
|
def test_vad_segments_api
|
|
@whisper.transcribe TestBase::AUDIO, @params
|
|
|
|
assert_equal 4, @whisper.full_n_vad_segments
|
|
@whisper.full_n_vad_segments.times do |i|
|
|
assert @whisper.full_get_vad_segment_t0(i) < @whisper.full_get_vad_segment_t1(i)
|
|
end
|
|
end
|
|
end
|