From d928f77d0e5b66e85e1f0ad8262f0c8df1f11dd9 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 12 Jul 2024 17:39:46 +0800 Subject: [PATCH] Add timestamps about streaming models for Swift API (#1113) --- swift-api-examples/SherpaOnnx.swift | 13 +++++++++++++ swift-api-examples/decode-file.swift | 1 + 2 files changed, 14 insertions(+) diff --git a/swift-api-examples/SherpaOnnx.swift b/swift-api-examples/SherpaOnnx.swift index 8365af7db..fe9b870e7 100644 --- a/swift-api-examples/SherpaOnnx.swift +++ b/swift-api-examples/SherpaOnnx.swift @@ -194,6 +194,19 @@ class SherpaOnnxOnlineRecongitionResult { } } + var timestamps: [Float] { + if let p = result.pointee.timestamps { + var timestamps: [Float] = [] + for index in 0..!) { self.result = result } diff --git a/swift-api-examples/decode-file.swift b/swift-api-examples/decode-file.swift index ab9bc44d6..bb71c668e 100644 --- a/swift-api-examples/decode-file.swift +++ b/swift-api-examples/decode-file.swift @@ -91,6 +91,7 @@ func run() { let result = recognizer.getResult() print("\nresult is:\n\(result.text)") + print("\nresult is:\n\(result.timestamps)") } @main