public final class NLUManager extends Object implements AutoCloseable
Spokestack's NLU manager follows the same setup pattern as its SpeechPipeline
and TTSManager
modules. The manager constructs the component ultimately responsible for
classification (an NLUService
) and manages the context required to
perform these classifications and dispatch events to registered listeners.
Modifier and Type | Class and Description |
---|---|
static class |
NLUManager.Builder
Fluent builder interface for initializing an NLU manager.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(TraceListener listener)
Add a new listener to receive trace events from the NLU subsystem.
|
AsyncResult<NLUResult> |
classify(String utterance)
Classify a user utterance, returning a wrapper that can either block
until the classification is complete or call a registered callback when
the result is ready.
|
void |
close()
Releases resources in use by the NLU module.
|
NLUService |
getNlu()
Get the NLU service currently in use.
|
void |
prepare()
Initializes the NLU service.
|
void |
removeListener(TraceListener listener)
Remove a trace listener, allowing it to be garbage collected.
|
public void prepare() throws Exception
Exception
- if there is an error during initialization.public NLUService getNlu()
public void close() throws Exception
close
in interface AutoCloseable
Exception
public AsyncResult<NLUResult> classify(String utterance)
utterance
- The utterance to classify.public void addListener(TraceListener listener)
listener
- The listener to add.public void removeListener(TraceListener listener)
listener
- The listener to remove.Copyright © 2021. All rights reserved.