Example of Automatic Speech Recognition Without Pickup UI
Automatic speech recognition (ASR) can recognize speech not longer than 60 seconds and convert the input speech into text in real time.
Join the DZone community and get the full member experience.Join For Free
Automatic Speech Recognition
Automatic speech recognition (ASR) can recognize speech not longer than 60 seconds and convert the input speech into text in real time. This service uses industry-leading deep learning technologies to achieve a recognition accuracy of over 95%. Currently, Mandarin Chinese (including Chinese-English bilingual speech), English, French, German, Spanish, and Italian can be recognized.
Currently, ASR is available only on Huawei phones.
ASR depends on the on-cloud API for speech recognition. During commissioning and usage, ensure that the device can access the Internet.
Integrating the Automatic Speech Recognition Service
You can integrate the automatic speech recognition (ASR) service in either of the following modes:
Integrate the ASR plug-in
Integrate the ASR SDK
The SDK provides only the basic ASR services, and you need to develop the speech pickup UI by yourself.
The sample code for integration through SDK is as follows:
// Import the ASR SDK.
Before API developement, you need to create custom layout based on your requirements. Check the below code
1. Set the ApiKey
2. Initialize ASR
3. Implement a speech recognition result listener callback
4. Set recognition parameters and call startRecognizing to start speech recognition
5. Add runtime permission in AndroidManifest.xml file.
6. Before startRecognizing need to check runtime permission, Check the below methods for check and request permissions
7. Add Count downtime like this:
8. Release resources after the detection are complete.
This article covers how to use ASR without Pickup UI, as always, do not use default one sometimes need to try custom ASR UI.
Opinions expressed by DZone contributors are their own.