I've read cmusphinx tutorial and ran successfully the pocketsphinx android demo.
Now I want to modify the demo and add support for Italian.
In the Italian model download page (here) I can see two files:
- cmusphinx-it-5.2.tar.gz: it contains model parameters;
- it.tar.gz: it contains the dictionary.
I copied dictionary under /src/main/assets/sync
and create a new folder /src/main/assets/sync/it-ptm
with the content of voxforge_it_sphinx.cd_cont_2000 to setup the model.
Then I modified file assets.lst
by adding the list of italian resources like this:
cmudict-en-us.dict
digits.gram
en-phone.dmp
en-us-ptm/README
en-us-ptm/feat.params
en-us-ptm/mdef
en-us-ptm/means
en-us-ptm/noisedict
en-us-ptm/sendump
en-us-ptm/transition_matrices
en-us-ptm/variances
it-ptm/feat.params
it-ptm/feature_transform
it-ptm/mdef
it-ptm/means
it-ptm/mixture_weights
it-ptm/noisedict
it-ptm/transition_matrices
it-ptm/variances
it.dic
menu.gram
weather.dmp
Finally I modified the code like this:
recognizer = defaultSetup()
.setAcousticModel(new File(assetsDir, "it-ptm"))
.setDictionary(new File(assetsDir, "it.dic"))
The project build successfully but the application crashes after assets sync. Here the logged error:
I/cmusphinx: INFO: pocketsphinx.c(145): Parsed model-specific feature parameters from /storage/emulated/0/Android/data/edu.cmu.sphinx.pocketsphinx/files/sync/it-ptm/feat.params
E/cmusphinx: FATAL: "cmn.c", line 126: Unknown CMN type 'batch'
Can someone tell me what's wrong? Thanks
Your pocketsphinx-android files are too old, you need to update them and it should work. You can checkout latest version from github
https://github.com/cmusphinx/pocketsphinx-android-demo