mirror of
https://github.com/Mintplex-Labs/whisper.cpp.git
synced 2026-07-19 12:52:59 -04:00
fc49ee4479
* 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
60 lines
1.4 KiB
Ruby
60 lines
1.4 KiB
Ruby
require 'rake/clean'
|
|
require "bundler/gem_tasks"
|
|
require "pathname"
|
|
require "yaml"
|
|
require "rake/testtask"
|
|
|
|
extsources = YAML.load_file("extsources.yaml")
|
|
SOURCES = FileList[]
|
|
extsources.each do |src|
|
|
basename = src.pathmap("%f")
|
|
dest = basename == "LICENSE" ? basename : basename.pathmap("ext/%f")
|
|
file src
|
|
file dest => src do |t|
|
|
cp t.source, t.name
|
|
end
|
|
SOURCES.include dest
|
|
end
|
|
CLEAN.include SOURCES
|
|
CLEAN.include FileList[
|
|
"ext/*.o",
|
|
"ext/*.metal",
|
|
"ext/whisper.{so,bundle,dll}",
|
|
"ext/depend"
|
|
]
|
|
|
|
task build: SOURCES + FileList[
|
|
"ext/extconf.rb",
|
|
"ext/ruby_whisper.h",
|
|
"ext/ruby_whisper.cpp",
|
|
"whispercpp.gemspec",
|
|
]
|
|
|
|
directory "pkg"
|
|
CLOBBER.include "pkg"
|
|
|
|
TEST_MODEL = "../../models/ggml-base.en.bin"
|
|
LIB_NAME = "whisper".ext(RbConfig::CONFIG["DLEXT"])
|
|
LIB_FILE = File.join("lib", LIB_NAME)
|
|
|
|
directory "lib"
|
|
task LIB_FILE => SOURCES + ["lib"] do |t|
|
|
Dir.chdir "ext" do
|
|
sh "ruby extconf.rb"
|
|
sh "make"
|
|
end
|
|
mv "ext/#{LIB_NAME}", t.name
|
|
end
|
|
CLEAN.include LIB_FILE
|
|
|
|
Rake::TestTask.new do |t|
|
|
t.test_files = FileList["tests/test_*.rb"]
|
|
end
|
|
task test: [TEST_MODEL, LIB_FILE]
|
|
|
|
file TEST_MODEL do
|
|
Dir.chdir "../.." do
|
|
sh "./models/download-ggml-model.sh base.en"
|
|
end
|
|
end
|