Delegate called when a speech client handles messages from the API or catches an error.
public protocol SpeechlyDelegate: class
The intended use of this protocol is with SpeechClientProtocol
.
class
Called when the client catches an error.
func speechlyClientDidCatchError(_ speechlyClient: SpeechlyProtocol, error: SpeechlyError)
- error: The error which was caught.
Called after the client has acknowledged a recognition context start.
func speechlyClientDidStartContext(_ speechlyClient: SpeechlyProtocol)
Called after the client has acknowledged a recognition context stop.
func speechlyClientDidStopContext(_ speechlyClient: SpeechlyProtocol)
Called after the client has processed an update to current SpeechSegment
.
func speechlyClientDidUpdateSegment(_ speechlyClient: SpeechlyProtocol, segment: Segment)
When the client receives messages from the API, it will use them to update the state of current speech segment, and dispatch the updated state to the delegate. The delegate can use these updates to react to the user input by using the intent, entities and transcripts contained in the segment.
Only one segment is active at a time, but since the processing is asynchronous, it is possible to have out-of-order delivery of segments.
- segment: The speech segment that has been updated.
Called after the client has received a new transcript message from the API.
func speechlyClientDidReceiveTranscript(_ speechlyClient: SpeechlyProtocol, contextId: String, segmentId: Int, transcript: Transcript)
- contextId: The ID of the recognition context that the transcript belongs to.
- segmentId: The ID of the speech segment that the transcript belongs to.
- transcript: The transcript received from the API.
Called after the client has received a new entity message from the API.
func speechlyClientDidReceiveEntity(_ speechlyClient: SpeechlyProtocol, contextId: String, segmentId: Int, entity: Entity)
- contextId: The ID of the recognition context that the entity belongs to.
- segmentId: The ID of the speech segment that the entity belongs to.
- entity: The entity received from the API.
Called after the client has received a new intent message from the API.
func speechlyClientDidReceiveIntent(_ speechlyClient: SpeechlyProtocol, contextId: String, segmentId: Int, intent: Intent)
- contextId: The ID of the recognition context that the intent belongs to.
- segmentId: The ID of the speech segment that the intent belongs to.
- transcript: The intent received from the API.