NSGodMode
NSGodMode

Reputation: 627

SFTranscriptionSegment's timestamp is always 0

This is a questoin regarding new iOS 10 Speech framework. I get the speech recognition result using following method

 recognitionTask =   [speechRecgzr recognitionTaskWithRequest:recognitionRequest resultHandler:^(SFSpeechRecognitionResult * _Nullable result, NSError * _Nullable error) {

    }

But the timestamp of each SFTranscriptionSegment in result is 0 and also confidence is always 0

What can be the problem here? Have apple not implemented the API properly yet?

Thank you.

Upvotes: 6

Views: 1222

Answers (3)

georgebrock
georgebrock

Reputation: 30083

I encountered the same problem, and found that the timestamp and duration are always zero on partial results, but are set correctly on final results.

Check isFinal on your SFSpeechRecognitionResult instance. If that's true, then the transcription segments will have this metadata.

If you only want to deal with final results, you can set shouldReportPartialResults to false on your SFSpeechRecognitionRequest.

Upvotes: 1

jamryu
jamryu

Reputation: 698

Swift 5+

speechRecgzr.defaultTaskHint = .dictation

Upvotes: 1

NSGodMode
NSGodMode

Reputation: 627

After few weeks I found that by setting this I can get timestamp and confidence:

speechRecgzr.defaultTaskHint = SFSpeechRecognitionTaskHintDictation;

Upvotes: 1

Related Questions