Hi, in my app I need continuously check if one of those words "Start , Stop" is spoken .
My app is an Android project.
I use the model hub4wsj_sc_8k .
Here is control.dic
START S T AA R T
STOP S T AA P
Here is control.gram :
START /1.0/
STOP /1.0/
Here is my code :
File modelsDir = new File(assetsDir, "models");
recognizer = defaultSetup()
.setAcousticModel(new File(modelsDir, "hmm/en_us"))
.setDictionary(new File(modelsDir, "dict/control.dic"))
.setRawLogDir(assetsDir).setKeywordThreshold(1e-20f)
.setSampleRate(8000)
.getRecognizer();
recognizer.addListener(this);
File g = new File(modelsDir, "grammar/control.gram");
recognizer.addKeywordSearch(KEY_CONTROL, g);
recognizer.startListening(KEY_CONTROL);
When I run my app, and say "Start" , the callback onPartialResult start being called continuously,with best score "0"; "Stop" is never detected, and also onResult is never called.
Last edit: alfahim 2015-03-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Start and stop are not very good keyphrases because they are too short. They will be often false detected. For best detection you can select phrases of 3-4 syllables.
To stop onPartialResult you need to stop restart the search after action is performed when keyword is detected.
For accurate detection you can tune detection threshold in the file. You can try values like 1.0 1e-10 1e-20 1e-30 and between and select the best balance between detection accuracy and false alarms.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you it's working fine now.
Using more syllables and "en-us-semi" instead of "hub4wsj_sc_8k", fixed the issue.
My concern now is about the apk size.
Last edit: alfahim 2015-03-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, in my app I need continuously check if one of those words "Start , Stop" is spoken .
My app is an Android project.
I use the model hub4wsj_sc_8k .
Here is control.dic
START S T AA R T
STOP S T AA P
Here is control.gram :
START /1.0/
STOP /1.0/
Here is my code :
File modelsDir = new File(assetsDir, "models");
recognizer = defaultSetup()
.setAcousticModel(new File(modelsDir, "hmm/en_us"))
.setDictionary(new File(modelsDir, "dict/control.dic"))
.setRawLogDir(assetsDir).setKeywordThreshold(1e-20f)
.setSampleRate(8000)
.getRecognizer();
recognizer.addListener(this);
File g = new File(modelsDir, "grammar/control.gram");
recognizer.addKeywordSearch(KEY_CONTROL, g);
recognizer.startListening(KEY_CONTROL);
When I run my app, and say "Start" , the callback onPartialResult start being called continuously,with best score "0"; "Stop" is never detected, and also onResult is never called.
Last edit: alfahim 2015-03-17
Start and stop are not very good keyphrases because they are too short. They will be often false detected. For best detection you can select phrases of 3-4 syllables.
To stop onPartialResult you need to stop restart the search after action is performed when keyword is detected.
For accurate detection you can tune detection threshold in the file. You can try values like 1.0 1e-10 1e-20 1e-30 and between and select the best balance between detection accuracy and false alarms.
Thanks Nickolay, I noticed that much of the noise is interpreted as "Stop" , is there any parameter I can tweak to reduce the noise impact ?
I wrote you about threshold and keyphrase length in the message above.
I've tested many thresholds but I still have the issue, maybe I need to switch to 16k.
To get help on accuracy you can provide an audio recording and the exact configuration for testing.
Thank you it's working fine now.
Using more syllables and "en-us-semi" instead of "hub4wsj_sc_8k", fixed the issue.
My concern now is about the apk size.
Last edit: alfahim 2015-03-17