Bonjour à tous.
Pour un stage, je dois compiler le logiciel pocketsphinx en langage C.
Mais ayant appris le C depuis peu (un Mois et demi) je ne suis pas assez familiarisé pour pouvoir réussir cette opération.
Je suis sur Linux 10.04. J'utilise GCC pour compiler. C'est assez d'urgent. D'ici Lundi je devrais finir de compiler.
Je dois simplement en gros indiquer des ordres vocaux à un robot.
Donc mon prof m'a indiqué de choisir un logiciel libre, j'ai pris sphinx.
je dois assigner des ordres sous la forme d'un dictionnaire de quatre mots ("go, stop, right, left"), ainsi que d'une grammaire en format JSFG, déjà faite.
Voici le code:
http://cmusphinx.sourceforge.net/wiki/tuturialpocketsphinx
- include <pocketsphinx.h>
int
main(int argc, char *argv[])
{
ps_decoder_t *ps;
cmd_ln_t *config;
FILE *fh;
char const *hyp, *uttid;
int16 buf[512];
int rv;
int32 score;
config = cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/hmm/en_US/hub4wsj_sc_8k",
"-lm", MODELDIR "/lm/en/turtle.DMP",
"-dict", MODELDIR "/lm/en/turtle.dic",
NULL);
if (config == NULL)
return 1;
ps = ps_init(config);
if (ps == NULL)
return 1;
fh = fopen("goforward.raw", "rb");
if (fh == NULL) {
perror("Failed to open goforward.raw");
return 1;
}
rv = ps_decode_raw(ps, fh, "goforward", -1);
if (rv < 0)
return 1;
hyp = ps_get_hyp(ps, &score, &uttid);
if (hyp == NULL)
return 1;
printf("Recognized: %s\n", hyp);
fseek(fh, 0, SEEK_SET);
rv = ps_start_utt(ps, "goforward");
if (rv < 0)
return 1;
while (!feof(fh)) {
size_t nsamp;
nsamp = fread(buf, 2, 512, fh);
rv = ps_process_raw(ps, buf, nsamp, FALSE, FALSE);
}
rv = ps_end_utt(ps);
if (rv < 0)
return 1;
hyp = ps_get_hyp(ps, &score, &uttid);
if (hyp == NULL)
return 1;
printf("Recognized: %s\n", hyp);
fclose(fh);
ps_free(ps);
return 0;
}
J'ai d'ores et déjà modifié pour charger mes fichiers au début soit:
onfig = cmd_ln_init(NULL, ps_args(), TRUE, "-hmm", MODELDIR "/hmm/en_US/hub4wsj_sc_8k", "-lm", MODELDIR "/lm/en/turtle.DMP", "-dict", MODELDIR "/lm/en/turtle.dic", NULL);
en ->
config = cmd_ln_init(NULL, ps_args(), TRUE, "-hmm", MODELDIR "/hmm/en_US/hub4wsj_sc_8k", "-jsgf", "<usr/Documents/grammar1.jsgf>", "-dict",
"<usr/Documents/Sphinx/pocketsphinx/model/lm/en/53
52.dic>" NULL);
Mais lorsque je compile j'ai ce message d'erreur:
http://www.imagup.com/data/1122892004.html
Comment pourrais-je compiler efficacement et rapidement s'il-vous plaît?
Merci.