Skip to content

Commit

Permalink
Support lang/emotion/event results from SenseVoice in Swift API. (#1346)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Sep 13, 2024
1 parent 6bf9310 commit 5d76171
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions swift-api-examples/SherpaOnnx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,26 @@ class SherpaOnnxOfflineRecongitionResult {
}
}

// For SenseVoice models, it can be zh, en, ja, yue, ko
// where zh is for Chinese
// en is for English
// ja is for Japanese
// yue is for Cantonese
// ko is for Korean
var lang: String {
return String(cString: result.pointee.lang)
}

// for SenseVoice models
var emotion: String {
return String(cString: result.pointee.emotion)
}

// for SenseVoice models
var event: String {
return String(cString: result.pointee.event)
}

init(result: UnsafePointer<SherpaOnnxOfflineRecognizerResult>!) {
self.result = result
}
Expand Down

0 comments on commit 5d76171

Please sign in to comment.