Module: Whisper
- Defined in:
- lib/whisper/model/uri.rb,
ext/ruby_whisper.c
Defined Under Namespace
Constant Summary collapse
- 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
- .lang_id(lang_name) ⇒ Integer
- .lang_max_id ⇒ Integer
- .lang_str(lang_id) ⇒ String
- .lang_str(lang_id) ⇒ String
- .- ⇒ nil
Class Method Details
.lang_id(lang_name) ⇒ Integer
51 52 53 54 55 56 57 58 |
# File 'ext/ruby_whisper.c', line 51 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
43 44 45 |
# File 'ext/ruby_whisper.c', line 43 static VALUE ruby_whisper_s_lang_max_id(VALUE self) { return INT2NUM(whisper_lang_max_id()); } |
.lang_str(lang_id) ⇒ String
64 65 66 67 68 69 70 71 |
# File 'ext/ruby_whisper.c', line 64 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
77 78 79 80 81 82 83 84 |
# File 'ext/ruby_whisper.c', line 77 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
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'ext/ruby_whisper.c', line 105 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; } |