Class: Whisper::Parakeet::Context
- Inherits:
-
Object
- Object
- Whisper::Parakeet::Context
- Includes:
- Output::Context
- Defined in:
- sig/whisper.rbs
Defined Under Namespace
Classes: Params
Class Method Summary collapse
-
.new ⇒ instance
Load a Parakeet model from the given file path.
Instance Method Summary collapse
-
#each_segment {|arg0| ... } ⇒ Object
Yields each Whisper::Parakeet::Segment:.
-
#full ⇒ Object
Run the entire model: PCM -> log mel spectrogram -> encoder -> decoder -> text.
-
#full_get_segment_t0 ⇒ Integer
Start time of a segment indexed by
segment_indexin centiseconds (10 times milliseconds). -
#full_get_segment_t1 ⇒ Integer
End time of a segment indexed by
segment_indexin centiseconds (10 times milliseconds). -
#full_get_segment_text ⇒ String
Text of a segment indexed by
segment_index. -
#full_get_token_data ⇒ Token
Token data of the token indexed by
token_indexin the segment indexed bysegment_index. -
#full_get_token_id ⇒ Integer
Token id of the token indexed by
token_indexin the segment indexed bysegment_index. -
#full_get_token_p ⇒ Float
Probability of the token indexed by
token_indexin the segment indexed bysegment_index. -
#full_get_token_text ⇒ String
Text of the token indexed by
token_indexin the segment indexed bysegment_index. -
#full_n_segments ⇒ Integer
Number of generated text segments.
-
#full_n_tokens ⇒ Integer
Number of tokens in the segment indexed by
segment_index. - #model ⇒ Model
-
#transcribe ⇒ self
Transcribe a single audio file.
Methods included from Output::Context
Class Method Details
.new ⇒ instance
Load a Parakeet model from the given file path.
636 |
# File 'sig/whisper.rbs', line 636
def self.new: (String | path | ::URI::HTTP, ?Params) -> instance
|
Instance Method Details
#each_segment ⇒ void #each_segment ⇒ Enumerator[Segment]
Yields each Whisper::Parakeet::Segment:
parakeet.transcribe("path/to/audio.wav", params)
parakeet.each_segment do |segment|
puts segment.text
end
Returns an Enumerator if no block given:
parakeet.transcribe("path/to/audio.wav", params)
enum = parakeet.each_segment
enum.to_a # => [#<Whisper::Parakeet::Segment>, ...]
708 709 |
# File 'sig/whisper.rbs', line 708
def each_segment: { (Segment) -> void } -> void
| () -> Enumerator[Segment]
|
#full(arg0, samples, n_samples) ⇒ self #full(arg0, arg1, n_samples) ⇒ self
Run the entire model: PCM -> log mel spectrogram -> encoder -> decoder -> text. Not thread safe for the same context.
The second argument samples must be an array of samples, respond to :length,
or be a MemoryView of an array of float. It must be 32 bit float PCM audio data.
648 649 |
# File 'sig/whisper.rbs', line 648
def full: (Whisper::Parakeet::Params, Array[Float] samples, ?Integer n_samples) -> self
| (Whisper::Parakeet::Params, _Samples, ?Integer n_samples) -> self
|
#full_get_segment_t0 ⇒ Integer
Start time of a segment indexed by segment_index in centiseconds (10 times milliseconds).
full_get_segment_t0(3) # => 1668 (16680 ms)
659 |
# File 'sig/whisper.rbs', line 659
def full_get_segment_t0: (Integer segment_index) -> Integer
|
#full_get_segment_t1 ⇒ Integer
End time of a segment indexed by segment_index in centiseconds (10 times milliseconds).
full_get_segment_t1(3) # => 1668 (16680 ms)
665 |
# File 'sig/whisper.rbs', line 665
def full_get_segment_t1: (Integer segment_index) -> Integer
|
#full_get_segment_text ⇒ String
Text of a segment indexed by segment_index.
full_get_segment_text(3) # => "ask not what your country can do for you, ..."
671 |
# File 'sig/whisper.rbs', line 671
def full_get_segment_text: (Integer segment_index) -> String
|
#full_get_token_data ⇒ Token
Token data of the token indexed by token_index in the segment indexed by segment_index.
691 |
# File 'sig/whisper.rbs', line 691
def full_get_token_data: (Integer segment_index, Integer token_index) -> Token
|
#full_get_token_id ⇒ Integer
Token id of the token indexed by token_index in the segment indexed by segment_index.
683 |
# File 'sig/whisper.rbs', line 683
def full_get_token_id: (Integer segment_index, Integer token_index) -> Integer
|
#full_get_token_p ⇒ Float
Probability of the token indexed by token_index in the segment indexed by segment_index.
687 |
# File 'sig/whisper.rbs', line 687
def full_get_token_p: (Integer segment_index, Integer token_index) -> Float
|
#full_get_token_text ⇒ String
Text of the token indexed by token_index in the segment indexed by segment_index.
679 |
# File 'sig/whisper.rbs', line 679
def full_get_token_text: (Integer segment_index, Integer token_index) -> String
|
#full_n_segments ⇒ Integer
Number of generated text segments.
653 |
# File 'sig/whisper.rbs', line 653
def full_n_segments: () -> Integer
|
#full_n_tokens ⇒ Integer
Number of tokens in the segment indexed by segment_index.
675 |
# File 'sig/whisper.rbs', line 675
def full_n_tokens: (Integer segment_index) -> Integer
|
#transcribe ⇒ self
Transcribe a single audio file.
640 |
# File 'sig/whisper.rbs', line 640
def transcribe: (path audio_file_path, Whisper::Parakeet::Params) -> self
|