i was trying to make word that was detected to execute file.py. here the source code that i try to modify at continuous.c
if (!in_speech && utt_started) {
/* speech -> silence transition, time to start new utterance */
ps_end_utt(ps);
hyp = ps_get_hyp(ps, NULL );
if (hyp = "OPEN"){
fopen("/home/pi/project/open.py", "r");
}
if (hyp != NULL) {
printf("%s\n", hyp);
fflush(stdout);
}
the program still detect the word but it still not execute the program that i want. and here is the command that i was using
pocketsphinx_continuous -lm /home/pi/project/3379.lm -dict /home/pi/project/3379.dic -samprate 16000/8000/48000 -inmic yes -adcdev plughw:1,0
really need help here. thanks before.
In C strings are compared with strcmp
, not with =
, with =
you just assign pointers, not even compare them.
It should be
if (strcmp(hyp, "OPEN") == 0) {
....
}