mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 21:45:19 +00:00
Force on-device transcription [experiment]
This commit is contained in:
parent
a02a2c96e0
commit
5dc4427538
@ -38,7 +38,7 @@ private func transcribeAudio(path: String, locale: String) -> Signal<Transcripti
|
||||
|
||||
return
|
||||
}
|
||||
speechRecognizerValue.defaultTaskHint = .unspecified
|
||||
speechRecognizerValue.defaultTaskHint = .dictation
|
||||
sharedRecognizers[locale] = speechRecognizerValue
|
||||
speechRecognizer = speechRecognizerValue
|
||||
|
||||
@ -47,6 +47,7 @@ private func transcribeAudio(path: String, locale: String) -> Signal<Transcripti
|
||||
} else {
|
||||
speechRecognizer.supportsOnDeviceRecognition = false
|
||||
}
|
||||
speechRecognizer.supportsOnDeviceRecognition = true
|
||||
}
|
||||
|
||||
let tempFilePath = NSTemporaryDirectory() + "/\(UInt64.random(in: 0 ... UInt64.max)).m4a"
|
||||
@ -57,7 +58,7 @@ private func transcribeAudio(path: String, locale: String) -> Signal<Transcripti
|
||||
request.addsPunctuation = true
|
||||
}
|
||||
request.requiresOnDeviceRecognition = speechRecognizer.supportsOnDeviceRecognition
|
||||
request.shouldReportPartialResults = true
|
||||
request.shouldReportPartialResults = false
|
||||
|
||||
let task = speechRecognizer.recognitionTask(with: request, resultHandler: { result, error in
|
||||
if let result = result {
|
||||
|
Loading…
x
Reference in New Issue
Block a user