Hi,
I am trying to get the Hello World example to work in XCode. I get the
following error when I run the code:
ERROR: "acmod.c", line 82: Must specify -mdef or -hmm
I looked into the cause, and it looks like when
ps = ps_init(config);
..is called, ps gets the value of NULL.
Stepping into the code, it looks like this is happening in the acoustic model
initialization. In the function cmd_ln_str_r(cmd_ln_t cmdln, char const name), it looks like it does some hashtable lookup which succeeds, but in the
statement
return (char const *)val->ptr;
val->ptr has a value of NULL.
Any idea how to solve this?
Thanks,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I do the initialization with this code (very similar to hello world example):
config = cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", resPath,
"-lm", langModelPath,
"-dict", dictPath,
NULL);
In the iPhone simulator, all "resource" files are put in 'resourcePath'. This
flattens the directory structure and all language model, ac model, and dict
files are in the same folder on disk. resPath, langModelPath and dictPath
point to the acoustic model folder (which is just the resourcePath), the
language model file "turtle.lm.xcode" (had to change extension because xcode
was complaining about the .lm extension), and the dict file "turtle.dict".
Again, all of these files are located in the same folder at resourcePath.
I tested the location by writing a file to resourcePath and it did show up at
the intended location on disk. So it seems that the location is the correct
one. The iphone pocketsphinx library that I'm using was from anchan77 in this
post.
Does the initialization look okay? I think it should be the same as the C
example.
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hm, it indeed could check mdef file presence and if it's missing it can fail.
Unfortunately the only way to check this is to debug ps_add_file function
call. You have to do this yourself.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I managed to fix it -- it was something silly. in all the confusion of the
resource paths being flattened into one directory, I didn't realize that one
of the arguments i was passing to cm_ln_init() was an NSString and not a
cstring.
Thanks for your help!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Mindthief, Im facing a similar problem.
In my case im running the app in simulator and passing it the goforward raw
file. But it just crashes.
Can you post the project or maybe give detail steps of how you used the code
posted by anchan77
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi saurwad,
A friend did some of the setup so I'm not really sure what all the steps
involved were, but if you let me know what specific problem you're having, I
may be able to help you. I would guess that you should just include the static
library file generated by the project from anchan77 and include it in yours
and modify the "Header search paths" field in Project properties to point to
$ANCHAN77_ROOT/includes. Does this make sense? I haven't tried this and I'm
new to Xcode, but it should work.
ERROR: "acmod.c", line 82: Must specify -mdef or -hmm
These are the steps which I followed.
1. Dowloaded all the three projects posted by anchan77
2.created a new iphone project
3.Copied libraries libiphonepocketsphinx.a and libiphonesphinxbase.a
(simulator ones) to the new project .
4.put the header search paths
5. app delegate i imported pocketshinx.h and built. Everything ran fine.
6. i downloaded pocketsphinx-0.5.1 and copied the model folder fthis to iphone project
7. Added this model folder as a resource to iphone project.Also copied goforward.raw to my project.
8.The lm files were giving Lex errors so renamed them to.lm.xcode as suggested
by you.
Hi,
I am trying to get the Hello World example to work in XCode. I get the
following error when I run the code:
ERROR: "acmod.c", line 82: Must specify -mdef or -hmm
I looked into the cause, and it looks like when
ps = ps_init(config);
..is called, ps gets the value of NULL.
Stepping into the code, it looks like this is happening in the acoustic model
initialization. In the function cmd_ln_str_r(cmd_ln_t cmdln, char const
name), it looks like it does some hashtable lookup which succeeds, but in the
statement
return (char const *)val->ptr;
val->ptr has a value of NULL.
Any idea how to solve this?
Thanks,
2010-03-07 16:32:35 MSK
You probably don't init config properly with code like
Hi,
I do the initialization with this code (very similar to hello world example):
config = cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", resPath,
"-lm", langModelPath,
"-dict", dictPath,
NULL);
In the iPhone simulator, all "resource" files are put in 'resourcePath'. This
flattens the directory structure and all language model, ac model, and dict
files are in the same folder on disk. resPath, langModelPath and dictPath
point to the acoustic model folder (which is just the resourcePath), the
language model file "turtle.lm.xcode" (had to change extension because xcode
was complaining about the .lm extension), and the dict file "turtle.dict".
Again, all of these files are located in the same folder at resourcePath.
I tested the location by writing a file to resourcePath and it did show up at
the intended location on disk. So it seems that the location is the correct
one. The iphone pocketsphinx library that I'm using was from anchan77 in this
post.
Does the initialization look okay? I think it should be the same as the C
example.
Thanks
Hm, it indeed could check mdef file presence and if it's missing it can fail.
Unfortunately the only way to check this is to debug ps_add_file function
call. You have to do this yourself.
Hi, I managed to fix it -- it was something silly. in all the confusion of the
resource paths being flattened into one directory, I didn't realize that one
of the arguments i was passing to cm_ln_init() was an NSString and not a
cstring.
Thanks for your help!
Hi Mindthief, Im facing a similar problem.
In my case im running the app in simulator and passing it the goforward raw
file. But it just crashes.
Can you post the project or maybe give detail steps of how you used the code
posted by anchan77
Hi saurwad,
A friend did some of the setup so I'm not really sure what all the steps
involved were, but if you let me know what specific problem you're having, I
may be able to help you. I would guess that you should just include the static
library file generated by the project from anchan77 and include it in yours
and modify the "Header search paths" field in Project properties to point to
$ANCHAN77_ROOT/includes. Does this make sense? I haven't tried this and I'm
new to Xcode, but it should work.
Also, you should take a look at the PocketSphinx "hello world" example here:
http://cmusphinx.sourceforge.net/wiki/PocketSphinxMigration
You need to include the models from the hello world example in your
"Resources" folder in Xcode. My post #3 in this thread has some info on this.
I am getting the same error as you did.
ERROR: "acmod.c", line 82: Must specify -mdef or -hmm
These are the steps which I followed.
1. Dowloaded all the three projects posted by anchan77
2.created a new iphone project
3.Copied libraries libiphonepocketsphinx.a and libiphonesphinxbase.a
(simulator ones) to the new project .
4.put the header search paths
5. app delegate i imported pocketshinx.h and built. Everything ran fine.
6. i downloaded pocketsphinx-0.5.1 and copied the model folder fthis to iphone project
7. Added this model folder as a resource to iphone project.Also copied goforward.raw to my project.
8.The lm files were giving Lex errors so renamed them to.lm.xcode as suggested
by you.
It crashes with amod.c error... What am i doing wrong. Can you tell the paths
you are using for initialization???
I notice you're using "executePath" -- not sure if that's different but I'm
using resourcePath.
The paths to the models are:
(But I think you can even get the paths to the model files by just appending
"turtle.lm.xcode" to the resourcePath, and same for the dictionary)