Module: Whisper
- Defined in:
- lib/whisper/context.rb,
lib/whisper/segment.rb,
lib/whisper/model/uri.rb,
ext/ruby_whisper.c
Defined Under Namespace
Modules: VAD
Classes: Context, Model, Segment
Constant Summary
collapse
- VERSION =
rb_str_new2(whisper_version())
- LOG_LEVEL_NONE =
INT2NUM(GGML_LOG_LEVEL_NONE)
- LOG_LEVEL_INFO =
INT2NUM(GGML_LOG_LEVEL_INFO)
- LOG_LEVEL_WARN =
INT2NUM(GGML_LOG_LEVEL_WARN)
- LOG_LEVEL_ERROR =
INT2NUM(GGML_LOG_LEVEL_ERROR)
- LOG_LEVEL_DEBUG =
INT2NUM(GGML_LOG_LEVEL_DEBUG)
- LOG_LEVEL_CONT =
INT2NUM(GGML_LOG_LEVEL_CONT)
Class Method Summary
collapse
Class Method Details
.lang_id(lang_name) ⇒ Integer
54
55
56
57
58
59
60
61
|
# File 'ext/ruby_whisper.c', line 54
static VALUE ruby_whisper_s_lang_id(VALUE self, VALUE lang) {
const char * lang_str = StringValueCStr(lang);
const int id = whisper_lang_id(lang_str);
if (-1 == id) {
rb_raise(rb_eArgError, "language not found: %s", lang_str);
}
return INT2NUM(id);
}
|
.lang_max_id ⇒ Integer
46
47
48
|
# File 'ext/ruby_whisper.c', line 46
static VALUE ruby_whisper_s_lang_max_id(VALUE self) {
return INT2NUM(whisper_lang_max_id());
}
|
.lang_str(lang_id) ⇒ String
67
68
69
70
71
72
73
74
|
# File 'ext/ruby_whisper.c', line 67
static VALUE ruby_whisper_s_lang_str(VALUE self, VALUE id) {
const int lang_id = NUM2INT(id);
const char * str = whisper_lang_str(lang_id);
if (NULL == str) {
rb_raise(rb_eIndexError, "id %d outside of language id", lang_id);
}
return rb_str_new2(str);
}
|
.lang_str(lang_id) ⇒ String
80
81
82
83
84
85
86
87
|
# File 'ext/ruby_whisper.c', line 80
static VALUE ruby_whisper_s_lang_str_full(VALUE self, VALUE id) {
const int lang_id = NUM2INT(id);
const char * str_full = whisper_lang_str_full(lang_id);
if (NULL == str_full) {
rb_raise(rb_eIndexError, "id %d outside of language id", lang_id);
}
return rb_str_new2(str_full);
}
|
.- ⇒ nil
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
# File 'ext/ruby_whisper.c', line 116
static VALUE ruby_whisper_s_log_set(VALUE self, VALUE log_callback, VALUE user_data) {
VALUE old_callback = rb_iv_get(self, "log_callback");
if (!NIL_P(old_callback)) {
rb_undefine_finalizer(old_callback);
}
rb_iv_set(self, "log_callback", log_callback);
rb_iv_set(self, "user_data", user_data);
VALUE finalize_log_callback = rb_funcall(mWhisper, rb_intern("method"), 1, rb_str_new2("finalize_log_callback"));
rb_define_finalizer(log_callback, finalize_log_callback);
whisper_log_set(ruby_whisper_log_callback, NULL);
return Qnil;
}
|
.system_info_str ⇒ String
93
94
95
|
# File 'ext/ruby_whisper.c', line 93
static VALUE ruby_whisper_s_system_info_str(VALUE self) {
return rb_str_new2(whisper_print_system_info());
}
|