STSRData Class Reference
| Declared in | STSRData.swift |
Overview
An object of STSRData class is generated by Voiceflow processing whenever a speech recognition hypothesis is available. The callback method STVFC_SRHypothesis(vfModuleID: String, srData: STSRData) available in the callback protocol STVoiceFlowCallback provides a STSRData object in realtime to an application that is registered for callbacks.
A class initializing an instance of STVoiceFlowRunner must be a subclass of STVoiceFlowCallback and must implement STVFC_SRHypothesis callback method in order to receive STSRData objects from STVoiceFlowRunner module.
Note: During STVFC_SRHypothesis callback, an application has the option to reject the speech recognition hypothesis and to inform Voiceflow processing to treat the recognized hypothesis as such by setting the parameter srClientRejectedHypothesis to true.
Sample implementation code::
public final class MyVoiceFlowClass: NSObject, STVoiceFlowCallback {
let voiceFlowRunner = STVoiceFlowRunner()
func_space_execute() {
var result = voiceFlowRunner.initialize()
result = voiceFlowRunner.initializeDefaultAudioSession()
voiceFlowRunner.setVoiceFlowCallback(self)
voiceFlowRunner.loadAudioPromptModules(...)
voiceFlowRunner.loadVoiceflow(...)
voiceFlowRunner.runVoiceflow()
}
// Optional implementation of `STVFC_SRHypothesis` callback method from STVoiceFlowCallback protocol
func STVFC_SRHypothesis(vfModuleID: String, srData: STSRData) {
if srData.srHypothesis != nil && !srData.srHypothesis!.isEmpty {
// Application processes STSRData object and may decide that it needs to be rejected or treated as garbage
if reject {
srData.srClientRejectedHypothesis = true
} else {
}
}
}
}
Tasks
-
srEnginepropertyThe name of the speech recognition engine providing speech recognition.
-
srHypothesispropertyThe speech recognition hypothesis.
-
srHypothesisTypepropertyThe type of speech recognition hypothesis, whether partial or complete. Value is
STNotifyMediaEvent.NME_SR_HYPOTHESIS_PARTIALorSTNotifyMediaEvent.NME_SR_HYPOTHESIS -
srResultStatuspropertyThe textual representation of the speech recognition result status code. Values: “<success>”, “<garbage>”, “<silence>”, “<stopped>”, “<canceled>”, and “<error>”.
-
srResultStatusCodepropertyThe speech recognition result status code.
-
srNumberOfSegmentspropertyThe number of segments availble in the speech recognition hypothesis. To obtain all the segments and the associated data, the client must be a subclass of
STEventsObserverDelegatein order to receive the SR hypothesis event directly fromSTMediaRunnermodule. -
srProbScorepropertyThe speech recognition probability score.
-
srSRScorepropertyThe speech recognition score.
-
srSRConfidencepropertyThe speech recognition confidence score.
-
srTaskIDpropertyThe ID of the speech recognition task producing the speech recognition hypothesis. This ID is provided by the client. Client will receive this ID with all event notifications and callbacks associated with speech recognition using this task.
-
srUtterancepropertyThe file path name of the speech recognition utterance that was used to perform speech recognition upon during offline speech recognition on recorded utterances.
-
srClientRejectedHypothesispropertyThis parameter is initially set to
false. DuringSTVFC_SRHypothesiscallback, an application has the option to set this parameter totrueso Voiceflow processing treats the speech recognition hypothesis as rejected orgarbage.
Properties
srClientRejectedHypothesis
public var srClientRejectedHypothesis: Bool?
Discussion
This parameter is initially set to false. During STVFC_SRHypothesis callback, an application has the option to set this parameter to true so Voiceflow processing treats the speech recognition hypothesis as rejected or garbage.
Declared In
STSRData.swift
srEngine
public var srEngine: String
Discussion
The name of the speech recognition engine providing speech recognition.
Declared In
STSRData.swift
srHypothesis
public var srHypothesis: String?
Discussion
The speech recognition hypothesis.
Declared In
STSRData.swift
srHypothesisType
public var srHypothesisType: STNotifyMediaEvent?
Discussion
The type of speech recognition hypothesis, whether partial or complete. Value is STNotifyMediaEvent.NME_SR_HYPOTHESIS_PARTIAL or STNotifyMediaEvent.NME_SR_HYPOTHESIS
Declared In
STSRData.swift
srNumberOfSegments
public var srNumberOfSegments: Int?
Discussion
The number of segments availble in the speech recognition hypothesis. To obtain all the segments and the associated data, the client must be a subclass of STEventsObserverDelegate in order to receive the SR hypothesis event directly from STMediaRunner module.
Declared In
STSRData.swift
srProbScore
public var srProbScore: Int?
Discussion
The speech recognition probability score.
Declared In
STSRData.swift
srResultStatus
public var srResultStatus: String?
Discussion
The textual representation of the speech recognition result status code. Values: “<success>”, “<garbage>”, “<silence>”, “<stopped>”, “<canceled>”, and “<error>”.
Declared In
STSRData.swift
srResultStatusCode
public var srResultStatusCode: STSRResultStatusCode?
Discussion
The speech recognition result status code.
Declared In
STSRData.swift
srSRConfidence
public var srSRConfidence: Float?
Discussion
The speech recognition confidence score.
Declared In
STSRData.swift
srSRScore
public var srSRScore: Int?
Discussion
The speech recognition score.
Declared In
STSRData.swift
srTaskID
public var srTaskID: String?
Discussion
The ID of the speech recognition task producing the speech recognition hypothesis. This ID is provided by the client. Client will receive this ID with all event notifications and callbacks associated with speech recognition using this task.
Declared In
STSRData.swift