SpeechRecognizer Class
Definition
Performs speech recognition from microphone, file, or other audio input streams, and gets transcribed text as result. Note: close() must be called in order to release underlying resources held by the object.
public class SpeechRecognizer extends Recognizer
- Inheritance
Inherited Members
Constructors
Fields
| canceled |
The event canceled signals that the recognition was canceled. |
| recognized |
The event recognized signals that a final recognition result is received. |
| recognizing |
The event recognizing signals that an intermediate recognition result is received. |
Methods
| getAuthorizationToken() |
Gets the authorization token used to communicate with the service. |
| getEndpointId() |
Gets the endpoint ID of a customized speech model that is used for speech recognition. |
| getOutputFormat() |
Gets the output format of recognition. |
| getProperties() |
The collection of properties and their values defined for this SpeechRecognizer. |
| getSpeechRecognitionLanguage() |
Gets the spoken language of recognition. |
| recognizeOnceAsync() |
Starts speech recognition, and returns after a single utterance is recognized. The end of a single utterance is determined by listening for silence at the end or until a maximum of 15 seconds of audio is processed. The task returns the recognition text as result. Note: Since recognizeOnceAsync() returns only a single utterance, it is suitable only for single shot recognition like command or query. For long-running multi-utterance recognition, use startContinuousRecognitionAsync() instead. |
| setAuthorizationToken(String token) |
Sets the authorization token used to communicate with the service. Note: The caller needs to ensure that the authorization token is valid. Before the authorization token expires, the caller needs to refresh it by calling this setter with a new valid token. Otherwise, the recognizer will encounter errors during recognition. |
| startContinuousRecognitionAsync() |
Starts speech recognition on a continuous audio stream, until stopContinuousRecognitionAsync() is called. User must subscribe to events to receive recognition results. |
| startKeywordRecognitionAsync(KeywordRecognitionModel model) |
Configures the recognizer with the given keyword model. After calling this method, the recognizer is listening for the keyword to start the recognition. Call stopKeywordRecognitionAsync() to end the keyword initiated recognition. User must subscribe to events to receive recognition results. Note: Keyword spotting (KWS) functionality might work with any microphone type, official KWS support, however, is currently limited to the microphone arrays found in the Azure Kinect DK hardware or the Speech Devices SDK. |
| stopContinuousRecognitionAsync() |
Stops a running recognition operation as soon as possible and immediately requests a result based on the the input that has been processed so far. This works for all recognition operations, not just continuous ones, and facilitates the use of push-to-talk or "finish now" buttons for manual audio endpointing. |
| stopKeywordRecognitionAsync() |
Ends the keyword initiated recognition. Note: Keyword spotting (KWS) functionality might work with any microphone type, official KWS support, however, is currently limited to the microphone arrays found in the Azure Kinect DK hardware or the Speech Devices SDK. |