Hello there,
I'm trying to create an android application with voice recognition using pocketsphinx android demo, to simplfy my application, I'm only trying the words recogition (Like in the "DEGITS" demo) the application works fine with it's default language English-US.
I want to add French to my application, so I can use both English and French recognition, so for testing purpose I'm trying to start the words recognition for French language as it is already a supported language.
I downloaded the:
1)cmusphinx-fr-ptm-8khz-5.2.tar.gz language model, and I'm not sure it is the correct file for my android application.
2)I also downloaded fr.dict since I'm only using words recognition.
I simply copied and pasted the downloaded files to my android project assets folder, and in my application, the MD5 files were generated since I have the sync assets already integrated in my application .
here is the link of my downloads:
in my java code I simply replaced and renamed the files like so:
private void setupRecognizer(File assetsDir) throws IOException {
recognizer = SpeechRecognizerSetup.defaultSetup()
.setAcousticModel(new File(assetsDir, "fr-fr-ptm"))
.setDictionary(new File(assetsDir, "cmudict-fr-fr.dict"))
.setRawLogDir(assetsDir) // To disable logging of raw audio comment out this call (takes a lot of space on the device)
.getRecognizer();
recognizer.addListener(this);
For the grammar, I created a new .gram file with 3 number words in French that exist in the dictionary like so:
#JSGF V1.0;grammarnumeros;
<numero> = un | deux | trois;
public<numeros> = <numero>+;
then simply replaced the digits.gram with my numero.gram in my java code:
File digitsGrammar = new File(assetsDir, "numeros.gram");
recognizer.addGrammarSearch(DIGITS_SEARCH, digitsGrammar);
After all these, I tried to run my application and it just crashes all the time I start the recognition here is the run log:
I also got the error saying that the Fr-fr.dict is 3225097 bytes which exeeds the 2560000 bytes and that the code insight features are not available. In the log file it says grammar error while the syntaxe is the same found in the the "DIGITS" .gram.
Please consider my issue and help me solving it out.
Thank you for further replies.
Last edit: AlexLutinNoir 2018-03-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes I did miss that one ";" there and I realized that just after posting I'm sorry, it's working like a charm now thank you, but is there any light dictionary I can use ? or do I have to create one myself ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello there,
I'm trying to create an android application with voice recognition using pocketsphinx android demo, to simplfy my application, I'm only trying the words recogition (Like in the "DEGITS" demo) the application works fine with it's default language English-US.
I want to add French to my application, so I can use both English and French recognition, so for testing purpose I'm trying to start the words recognition for French language as it is already a supported language.
I downloaded the:
1)cmusphinx-fr-ptm-8khz-5.2.tar.gz language model, and I'm not sure it is the correct file for my android application.
2)I also downloaded fr.dict since I'm only using words recognition.
I simply copied and pasted the downloaded files to my android project assets folder, and in my application, the MD5 files were generated since I have the sync assets already integrated in my application .
here is the link of my downloads:
in my java code I simply replaced and renamed the files like so:
For the grammar, I created a new .gram file with 3 number words in French that exist in the dictionary like so:
then simply replaced the digits.gram with my numero.gram in my java code:
After all these, I tried to run my application and it just crashes all the time I start the recognition here is the run log:
I also got the error saying that the Fr-fr.dict is 3225097 bytes which exeeds the 2560000 bytes and that the code insight features are not available.
In the log file it says grammar error while the syntaxe is the same found in the the "DIGITS" .gram.
Please consider my issue and help me solving it out.
Thank you for further replies.
Last edit: AlexLutinNoir 2018-03-22
It says your JSGF file is not properly formatted. You missed ; before teh second line, it should be like this:
If you fix JSGF it might work
Yes I did miss that one ";" there and I realized that just after posting I'm sorry, it's working like a charm now thank you, but is there any light dictionary I can use ? or do I have to create one myself ?
You can easily create it yourself.