react-native-kie-android-voice
react-native-kie-android-voice is a speech-to-text library for React Native for the Android Platform.
Issues section above
Any Feedback and Ideas are welcome! please use theDocumentation
Install
npm install --save react-native-kie-android-voice
Usage
Linking the Library
Add it to your android project
- In
android/settings.gradle
...include ':VoiceModule', ':app'project(':VoiceModule').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-kie-android-voice')
- In
android/app/build.gradle
...dependencies { ... compile project(':VoiceModule')}
- Register Module (in MainApplication.java)
// <--- import
Example
; ...async { try //More Locales will be available upon release. var spokenText = await SpeechAndroid; ToastAndroid; catcherror }...
This will automatically start recognizing and adjusting for the German Language. On release I'll update these docs with every single Locale available.
Methods
startSpeech(prompt, locale)
Initializes the voice recognition activity and returns what you spoke in text.
Arguments
- prompt: String for the text to be displayed by the SpeechRecognizer dialog;
- locale: String for the SpeechRecognizer to set itself for the given Locale; (Accessible through constants. see below available locales)
Locales:
DEFAULT
SpeechAndroidDEFAULT
This will set the SpeechRecognizer to the default locale of your Android smartphone.
Portugal / Portuguese
SpeechAndroidPT /*or*/ SpeechAndroidPORTUGUESE
Brazil / Portuguese
SpeechAndroidBR /*or*/ SpeechAndroidPORTUGUESE_BRAZIL
Bulgarian
SpeechAndroidBULGARIAN
Canada / English
SpeechAndroidCANADA
Canada / French
SpeechAndroidCANADA_FRENCH
Czech
SpeechAndroidCZECH
Croatian
SpeechAndroidCROATIAN
Chinese
SpeechAndroidCHINA /*or*/ SpeechAndroidCHINESE /*or*/SpeechAndroidSIMPLIFIED_CHINESE /*or*/ SpeechAndroidTRADITIONAL_CHINESE
Netherlands / Dutch
SpeechAndroidDUTCH
Belgium / Dutch
SpeechAndroidDUTCH_BELGIUM
English
SpeechAndroidENGLISH
UK / English
SpeechAndroidUK
US / English
SpeechAndroidUS
Australia / English
SpeechAndroidAUSTRALIA
New Zealand / English
SpeechAndroidNEW_ZEALAND
Singapore / English
SpeechAndroidSINGAPORE
India / English
SpeechAndroidENGLISH_INDIA
Ireland / English
SpeechAndroidENGLISH_IRELAND
Zimbabwe / English
SpeechAndroidENGLISH_ZIMBABWE
Egypt / Arabic
SpeechAndroidARABIC_EGYPT
Israel / Arabic
SpeechAndroidARABIC_ISRAEL
France / French
SpeechAndroidFRANCE /*or*/ SpeechAndroidFRENCH
Belgium / French
SpeechAndroidFRENCH_BELGIUM
Switzerland / French
SpeechAndroidFRENCH_SWITZERLAND
Finnish
SpeechAndroidFINNISH
Danish
SpeechAndroidDANISH
Germany / German
SpeechAndroidGERMANY /*or*/ SpeechAndroidGERMAN
Switzerland / German
SpeechAndroidGERMAN_SWITZERLAND
Greek
SpeechAndroidGREEK
Hebrew
SpeechAndroidHEBREW
Hindi
SpeechAndroidHINDI
Hungarian
SpeechAndroidHUNGARIAN
Italy / Italian
SpeechAndroidITALY /*or*/ SpeechAndroidITALIAN
Switzerland / Italian
SpeechAndroidITALIAN_SWITZERLAND
Indonesian
SpeechAndroidINDONESIAN
Latvian
SpeechAndroidLATVIAN
Lithuanian
SpeechAndroidLITHUANIAN
Norwegian
SpeechAndroidNORWEGIAN
Japan
SpeechAndroidJAPAN /*or*/ SpeechAndroidJAPANESE
Polish
SpeechAndroidPOLISH
Russian
SpeechAndroidRUSSIAN
Romanian
SpeechAndroidROMANIAN
Spanish
SpeechAndroidSPANISH
Catalan
SpeechAndroidCATALAN
US / Spanish
SpeechAndroidSPANISH_US
Serbian
SpeechAndroidSERBIAN
Slovak
SpeechAndroidSLOVAK
Slovenian
SpeechAndroidSLOVENIAN
Swedish
SpeechAndroidSWEDISH
Korea
SpeechAndroidKOREA /*or*/ SpeechAndroidKOREAN
Taiwan
SpeechAndroidTAIWAN
Philippines / Tagalog
SpeechAndroidTAGALOG_PHILIPPINES
Thai
SpeechAndroidTHAI
Turkish
SpeechAndroidTURKISH
Ukrainian
SpeechAndroidUKRAINIAN
Vietnamese
SpeechAndroidVIETNAMESE
Errors
E_ACTIVITY_DOES_NOT_EXIST
SpeechAndroidE_ACTIVITY_DOES_NOT_EXIST
Generic error on current Activity not existing.
E_VOICE_CANCELLED
SpeechAndroidE_VOICE_CANCELLED
Voice Recognizer was cancelled
E_FAILED_TO_SHOW_VOICE
SpeechAndroidE_FAILED_TO_SHOW_VOICE
Voice Recognizer failed to initialize
E_AUDIO_ERROR
SpeechAndroidE_AUDIO_ERROR
Voice Recognizer encountered some error with the Audio received
E_NETWORK_ERROR
SpeechAndroidE_NETWORK_ERROR
Network error while attempting connection with Google's Servers
E_NO_MATCH
SpeechAndroidE_NO_MATCH
Voice Recognizer did not find any match
E_SERVER_ERROR
SpeechAndroidE_SERVER_ERROR
Google's Servers encountered an error while processing the request
License
The MIT License (MIT)
Copyright © 2015
João Cunha
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.