Add timestamps for offline paraformer (#310)

This commit is contained in:
Fangjun Kuang
2023-09-14 19:33:41 +08:00
committed by GitHub
parent 47184f9db7
commit e2be532b32
11 changed files with 175 additions and 33 deletions

View File

@@ -349,6 +349,23 @@ class SherpaOnnxOfflineRecongitionResult {
return String(cString: result.pointee.text)
}
var count: Int32 {
return result.pointee.count
}
var timestamps: [Float] {
if let p = result.pointee.timestamps {
var timestamps: [Float] = []
for index in 0..<count {
timestamps.append(p[Int(index)])
}
return timestamps
} else {
let timestamps: [Float] = []
return timestamps
}
}
init(result: UnsafePointer<SherpaOnnxOfflineRecognizerResult>!) {
self.result = result
}