Add safe bindings for speaker diarization
This commit is contained in:
parent
586c517c1c
commit
384ddd77a5
2 changed files with 30 additions and 0 deletions
|
|
@ -517,6 +517,20 @@ impl WhisperContext {
|
||||||
pub fn token_transcribe(&self) -> WhisperToken {
|
pub fn token_transcribe(&self) -> WhisperToken {
|
||||||
unsafe { whisper_rs_sys::whisper_token_transcribe(self.ctx) }
|
unsafe { whisper_rs_sys::whisper_token_transcribe(self.ctx) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get whether the next segment is predicted as a speaker turn
|
||||||
|
///
|
||||||
|
/// # Arguments
|
||||||
|
/// * i_segment: Segment index.
|
||||||
|
///
|
||||||
|
/// # Returns
|
||||||
|
/// bool
|
||||||
|
///
|
||||||
|
/// # C++ equivalent
|
||||||
|
/// `bool whisper_full_get_segment_speaker_turn_next(struct whisper_context * ctx, int i_segment)`
|
||||||
|
pub fn full_get_segment_speaker_turn_next(&mut self, i_segment: c_int) -> bool {
|
||||||
|
unsafe { whisper_rs_sys::whisper_full_get_segment_speaker_turn_next(self.ctx, i_segment) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for WhisperContext {
|
impl Drop for WhisperContext {
|
||||||
|
|
|
||||||
|
|
@ -544,4 +544,20 @@ impl<'a> WhisperState<'a> {
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get whether the next segment is predicted as a speaker turn.
|
||||||
|
///
|
||||||
|
/// # Arguments
|
||||||
|
/// * i_segment: Segment index.
|
||||||
|
///
|
||||||
|
/// # Returns
|
||||||
|
/// bool
|
||||||
|
///
|
||||||
|
/// # C++ equivalent
|
||||||
|
/// `bool whisper_full_get_segment_speaker_turn_next_from_state(struct whisper_state * state, int i_segment)`
|
||||||
|
pub fn full_get_segment_speaker_turn_next(&mut self, i_segment: c_int) -> bool {
|
||||||
|
unsafe {
|
||||||
|
whisper_rs_sys::whisper_full_get_segment_speaker_turn_next_from_state(self.ptr, i_segment)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue