SpeechPipelineBuilder
@objc
public class SpeechPipelineBuilder : NSObject
Convenience initializer for building a SpeechPipeline
instance using a pre-configured profile. A pipeline profile encapsulates a series of configuration values tuned for a specific task.
Profiles are not authoritative; they act just like calling a series of methods on a SpeechPipelineBuilder
, and any configuration properties they set can be overridden by subsequent calls.
- Example:
// assume that self implements the SpeechEventListener protocol let pipeline = SpeechPipelineBuilder() .addListener(self) .setDelegateDispatchQueue(DispatchQueue.main) .useProfile(.tfLiteWakewordAppleSpeech) .setProperty("tracing", Trace.Level.PERF) .setProperty("detectModelPath", detectPath) .setProperty("encodeModelPath", encodePath) .setProperty("filterModelPath", filterPath) .build() pipeline.start()
-
Applies configuration from
SpeechPipelineProfiles
to the current builder, returning the modified builder.Declaration
Swift
@objc public func useProfile(_ profile: SpeechPipelineProfiles) -> SpeechPipelineBuilder
Parameters
profile
Name of the profile to apply.
Return Value
An updated instance of
SpeechPipelineBuilder
for call chaining. -
Sets a
SpeechConfiguration
configuration value.See also
SpeechConfiguration
Declaration
Swift
@objc public func setProperty(_ key: String, _ value: Any) -> SpeechPipelineBuilder
Parameters
key
Configuration property name
value
Configuration property value
Return Value
An updated instance of
SpeechPipelineBuilder
for call chaining. -
Replaces the default speech configuration with the specified configuration.
Warning
All preceedingsetProperty
calls will be erased by setting the configuration explicitly.Declaration
Swift
@objc public func setConfiguration(_ config: SpeechConfiguration) -> SpeechPipelineBuilder
Parameters
config
An instance of SpeechConfiguration that the pipeline will use.
-
Delegate events will be sent using the specified dispatch queue.
See also
SpeechConfiguration
Declaration
Swift
@objc public func setDelegateDispatchQueue(_ queue: DispatchQueue) -> SpeechPipelineBuilder
Parameters
queue
A
DispatchQueue
instanceReturn Value
An updated instance of
SpeechPipelineBuilder
for call chaining. -
Delegate events will be sent to the specified listener.
Declaration
Swift
@objc public func addListener(_ listener: SpokestackDelegate) -> SpeechPipelineBuilder
Parameters
listener
A
SpeechEventListener
instance.Return Value
An updated instance of
SpeechPipelineBuilder
for instace function call chaining. -
Build this configuration into a
SpeechPipeline
instance.Declaration
Swift
@objc public func build() throws -> SpeechPipeline
Return Value
A
SpeechPipeline
instance.