]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
ruby : support new-segment callback (#2506)
authorKITAITI Makoto <redacted>
Mon, 28 Oct 2024 13:43:27 +0000 (22:43 +0900)
committerGitHub <redacted>
Mon, 28 Oct 2024 13:43:27 +0000 (15:43 +0200)
commitfc49ee4479c59372b34c40cdfb71ea2a96836c8c
tree11c13fc87125c1b9f0391738796d366673e46ba9
parentc0ea41f6b2acdff034872ef39fe42b4e4da19a59
ruby : support new-segment callback (#2506)

* Add Params#new_segment_callback= method

* Add tests for Params#new_segment_callback=

* Group tests for #transcribe

* Don't use static for thread-safety

* Set new_segment_callback only when necessary

* Remove redundant check

* [skip ci] Add Ruby version README

* Revert "Group tests for #transcribe"

This reverts commit 71b65b00ccf1816c9ea8a247fb30f71bc09707d3.

* Revert "Add tests for Params#new_segment_callback="

This reverts commit 81e6df3bab7662da5379db51f28a989db7408c02.

* Add test for Context#full_n_segments

* Add Context#full_n_segments

* Add tests for lang API

* Add lang API

* Add tests for Context#full_lang_id API

* Add Context#full_lang_id

* Add abnormal test cases for lang

* Raise appropriate errors from lang APIs

* Add tests for Context#full_get_segment_t{0,1} API

* Add Context#full_get_segment_t{0,1}

* Add tests for Context#full_get_segment_speaker_turn_next API

* Add Context#full_get_segment_speaker_turn_next

* Add tests for Context#full_get_segment_text

* Add Context#full_get_setgment_text

* Add tests for Params#new_segment_callback=

* Run new segment callback

* Split tests to multiple files

* Use container struct for new segment callback

* Add tests for Params#new_segment_callback_user_data=

* Add Whisper::Params#new_user_callback_user_data=

* Add GC-related test for new segment callback

* Protect new segment callback related structs from GC

* Add meaningful test for build

* Rename: new_segment_callback_user_data -> new_segment_callback_container

* Add tests for Whisper::Segment

* Add Whisper::Segment and Whisper::Context#each_segment

* Extract c_ruby_whisper_callback_container_allocate()

* Add test for Whisper::Params#on_new_segment

* Add Whisper::Params#on_new_egment

* Assign symbol IDs to variables

* Make extsources.yaml simpler

* Update README

* Add document comments

* Add test for calling Whisper::Params#on_new_segment multiple times

* Add file dependencies to GitHub actions config and .gitignore

* Add more files to ext/.gitignore
14 files changed:
.github/workflows/bindings-ruby.yml
bindings/ruby/.gitignore
bindings/ruby/README.md [new file with mode: 0644]
bindings/ruby/Rakefile
bindings/ruby/ext/.gitignore
bindings/ruby/ext/ruby_whisper.cpp
bindings/ruby/ext/ruby_whisper.h
bindings/ruby/extsources.yaml
bindings/ruby/tests/test_callback.rb [new file with mode: 0644]
bindings/ruby/tests/test_package.rb [new file with mode: 0644]
bindings/ruby/tests/test_params.rb [new file with mode: 0644]
bindings/ruby/tests/test_segment.rb [new file with mode: 0644]
bindings/ruby/tests/test_whisper.rb
bindings/ruby/whispercpp.gemspec