Fangjun Kuang
Committed by GitHub

Support lang/emotion/event results from SenseVoice in Swift API. (#1346)

@@ -475,6 +475,26 @@ class SherpaOnnxOfflineRecongitionResult { @@ -475,6 +475,26 @@ class SherpaOnnxOfflineRecongitionResult {
475 } 475 }
476 } 476 }
477 477
  478 + // For SenseVoice models, it can be zh, en, ja, yue, ko
  479 + // where zh is for Chinese
  480 + // en is for English
  481 + // ja is for Japanese
  482 + // yue is for Cantonese
  483 + // ko is for Korean
  484 + var lang: String {
  485 + return String(cString: result.pointee.lang)
  486 + }
  487 +
  488 + // for SenseVoice models
  489 + var emotion: String {
  490 + return String(cString: result.pointee.emotion)
  491 + }
  492 +
  493 + // for SenseVoice models
  494 + var event: String {
  495 + return String(cString: result.pointee.event)
  496 + }
  497 +
478 init(result: UnsafePointer<SherpaOnnxOfflineRecognizerResult>!) { 498 init(result: UnsafePointer<SherpaOnnxOfflineRecognizerResult>!) {
479 self.result = result 499 self.result = result
480 } 500 }