Adding in a way to retrieve the detected language for golang bindings

Adding in a function, GetDetectedLanguage, which will retrieve the detected language, if available.
This commit is contained in:
Amanda Der Bedrosian 2024-09-26 11:20:12 -07:00
parent cdce0ff157
commit 8d60666cbc
2 changed files with 10 additions and 4 deletions

View File

@ -289,6 +289,10 @@ func (context *context) IsLANG(t Token, lang string) bool {
}
}
func (context *context) GetDetectedLanguage() string {
return whisper.Whisper_lang_str(context.model.ctx.Whisper_full_lang_id())
}
///////////////////////////////////////////////////////////////////////////////
// PRIVATE METHODS

View File

@ -41,6 +41,8 @@ type Context interface {
SetTranslate(bool) // Set translate flag
IsMultilingual() bool // Return true if the model is multilingual.
Language() string // Get language
GetDetectedLanguage() string // Get auto detected language
SetOffset(time.Duration) // Set offset
SetDuration(time.Duration) // Set duration