SpokestackBuilder
@objc
public class SpokestackBuilder : NSObject
Fluent builder interface for configuring Spokestack.
Example: using all the builder functions
let spokestack = try! SpokestackBuilder() .addDelegate(self) .usePipelineProfile(.vadTriggerAppleSpeech) .setConfiguration(SpeechConfiguration) .setProperty("tracing", Trace.Level.DEBUG) .setDelegateDispatchQueue(DispatchQueue.main) .build()
See also
-
Create a Spokestack builder with a default configuration.
Declaration
Swift
@objc public override init() -
Delegate events will be sent to the specified listener.
Declaration
Swift
@objc public func addDelegate(_ delegate: SpokestackDelegate) -> SpokestackBuilderParameters
listenerA
SpokestackDelegateinstance.Return Value
An updated instance of
SpokestackBuilder -
Applies configuration from
SpeechPipelineProfilesto the current builder, returning the modified builder.Declaration
Swift
@objc public func usePipelineProfile(_ profile: SpeechPipelineProfiles) -> SpokestackBuilderParameters
profileName of the profile to apply.
Return Value
An updated instance of
SpokestackBuilderfor call chaining. -
Sets a
SpeechConfigurationconfiguration value.See also
SpeechConfigurationDeclaration
Swift
@objc public func setProperty(_ key: String, _ value: Any) -> SpokestackBuilderParameters
keyConfiguration property name
valueConfiguration property value
Return Value
An updated instance of
SpeechPipelineBuilderfor call chaining. -
Replaces the default speech configuration with the specified configuration.
Warning
All preceedingsetPropertycalls will be erased by setting the configuration explicitly.Declaration
Swift
@objc public func setConfiguration(_ config: SpeechConfiguration) -> SpokestackBuilderParameters
configAn instance of SpeechConfiguration that the pipeline will use.
-
Delegate events will be sent using the specified dispatch queue.
See also
SpeechConfigurationDeclaration
Swift
@objc public func setDelegateDispatchQueue(_ queue: DispatchQueue) -> SpokestackBuilderParameters
queueA
DispatchQueueinstanceReturn Value
An updated instance of
SpeechPipelineBuilderfor call chaining. -
Sets a transcript editor used to alter ASR transcripts before they are classified by the NLU subsystem.
If a transcript editor is set, registered listeners will still receive the
didRecognizeevent from the speech pipeline with the unedited transcript, but the editor will automatically run on that transcript before the NLU module operates on it. Thus, theutteranceinside theNLUResultreturned by classification will reflect the edited version of the transcript.This can be used to alter ASR results that frequently contain a spelling for a homophone that’s incorrect for the domain; for example, an app used to summon a genie whose ASR transcripts tend to contain “Jen” instead of “djinn”.
Note
Transcript editors are not run automatically on inputs to theclassify(string:)convenience method.Declaration
Swift
@objc public func setTranscriptEditor(_ editor: TranscriptEditor) -> SpokestackBuilderParameters
editorA transcript editor used to alter ASR results before NLU classification.
Return Value
An updated instance of
SpeechPipelineBuilderfor call chaining. -
Build this configuration into a
Spokestackinstance.Throws
AnNLUErrorif the NLU module was unable to build.Declaration
Swift
@objc public func build() throws -> SpokestackReturn Value
An instance of
Spokestack.
View on GitHub
SpokestackBuilder Class Reference