KeywordRecognizer Class
- java.
lang. Object - com.
microsoft. cognitiveservices. speech. KeywordRecognizer
- com.
Implements
public final class KeywordRecognizer
implements java.lang.AutoCloseable
Performs keyword recognition on the speech input. Note: close() must be called in order to release underlying resources held by the object.
Field Summary
Modifier and Type | Field and Description |
---|---|
final
Event |
canceled
The signal for events relating to the cancellation of an interaction. |
final
Event |
recognized
The signal for events related to the recognition of keywords |
Constructor Summary
Constructor | Description |
---|---|
KeywordRecognizer(AudioConfig audioConfig) |
Creates a new instance of a keyword recognizer. |
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
close()
Dispose of associated resources. |
Safe |
getImpl()
Internal method to get the underlying handle to the keyword recognizer. |
Property |
getProperties()
The collection of properties and their values defined for Keyword |
java.util.concurrent.Future<Keyword |
recognizeOnceAsync(KeywordRecognitionModel model)
Starts a keyword recognition session. |
java.util.concurrent.Future<java.lang.Void> |
stopRecognitionAsync()
Stops a currently active keyword recognition session. |
Methods inherited from java.lang.Object
Field Details
canceled
public final EventHandlerImpl
The signal for events relating to the cancellation of an interaction. The event indicates if the reason is a direct cancellation or an error.
recognized
public final EventHandlerImpl
The signal for events related to the recognition of keywords
Constructor Details
KeywordRecognizer
public KeywordRecognizer(AudioConfig audioConfig)
Creates a new instance of a keyword recognizer. If no audio config is provided as input parameter, it will be equivalent to calling with a config constructed with AudioConfig::FromDefaultMicrophoneInput.
Parameters:
Method Details
close
public void close()
Dispose of associated resources. Note: close() must be called in order to release underlying resources held by the object.
getImpl
public SafeHandle getImpl()
Internal method to get the underlying handle to the keyword recognizer.
Returns:
getProperties
public PropertyCollection getProperties()
The collection of properties and their values defined for KeywordRecognizer.
Returns:
recognizeOnceAsync
public Future
Starts a keyword recognition session. This session will last until the first keyword is recognized. When this happens, Recognized event will be raised and the session will end. To rearm the keyword, the method needs to be called again after the event is emitted. Note: If no keyword is detected in the input, the task will never resolve unless StopRecognition method is called.
Parameters:
Returns:
stopRecognitionAsync
public Future
Stops a currently active keyword recognition session.
Returns:
Applies to
Azure SDK for Java