Menu

do you have the source file pocket_continuous

Help
Jolyxie
2012-05-03
2012-09-22
  • Jolyxie

    Jolyxie - 2012-05-03

    hello :
    do you have the source file of the pocketsphinx_continuous?
    why the result of "./hello_ps " is always the same :goforward ten meter .....
    how can the "hello_ps" works like "pocketsphinx_continuous" ?????

    hello_ps.c

    include <pocketsphinx.h></pocketsphinx.h>

    define MODELDIR "/usr/local/share/pocketsphinx/model"

    int main(int argc, char argv){
    ps_decoder_t
    ps;
    cmd_ln_t config;
    FILE
    fh;
    char const hyp, uttid;
    int16 buf;
    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);/initialize the decoder, use ps_init/
    if (ps == NULL) return 1;
    /Decoding a file stream/
    fh = fopen("goforward.raw", "rb");

    if (fh == NULL) { perror("Failed to open goforward.raw"); return 1; }

    /decode it, using ps_decode_raw():/
    rv = ps_decode_raw(ps, fh, "goforward", -1);

    if (rv < 0) return 1;
    /to get the hypothesis(假设), we can use ps_get_hyp():/
    hyp = ps_get_hyp(ps, &score, &uttid);

    if (hyp == NULL) return 1;

    printf("Recognized: %s\n", hyp);

    fseek(fh, 0, SEEK_SET);
    /start the utterance using ps_start_utt()/
    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;
    }

    thank you very much!!

     
  • Nickolay V. Shmyrev

    do you have the source file of the pocketsphinx_continuous?

    pocketsphinx/src/programs/continuous.c

    why the result of "./hello_ps " is always the same :goforward ten meter
    .....

    Because it recognizes audio from the file containing this phrase. It doesn't
    recognize audio from microphone

    how can the "hello_ps" works like "pocketsphinx_continuous" ?????

    If the source code of hello_ps will do the same as pocketsphinx_continuous is
    doing, the hello_ps will work the same way.

     
  • Jolyxie

    Jolyxie - 2012-05-03

    oh~~~i know more,,,,thank you !

     
  • Jolyxie

    Jolyxie - 2012-05-03

    oh ,yes
    i have one more question :
    can the pocketsphinx be use to ARM,(the system is linux)???
    use arm-linux-gcc~ to compile it ~~
    or whether it should change something?

     
  • Nickolay V. Shmyrev

    can the pocketsphinx be use to ARM,(the system is linux)???

    Yes

    use arm-linux-gcc~ to compile it ~~ or whether it should change something?

    Google for cross-compiling guide, there are quite many of them.

     
  • Jolyxie

    Jolyxie - 2012-05-03

    hello,nshmyrev

    i have try it ,but the termina show that :

    make

    arm-linux-gcc recognise.c -o recognise -DMODELDIR=\
    "/usr/local/share/pocketsphinx/model \ "-I/usr/local/include
    -I/usr/local/include/sphinxbase -I/usr/local/include/pocketsphinx
    -L/usr/local/lib -lpocketsphinx -lsphinxbase -lsphinxad
    /usr/local/arm/4.5.1/bin/../lib/gcc/arm-none-linux-gnueabi/4.5.1
    /../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible
    /usr/local/lib/libpocketsphinx.so when searching for -lpocketsphinx
    /usr/local/arm/4.5.1/bin/../lib/gcc/arm-none-linux-gnueabi/4.5.1
    /../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible
    /usr/local/lib/libpocketsphinx.a when searching for -lpocketsphinx
    /usr/local/arm/4.5.1/bin/../lib/gcc/arm-none-linux-gnueabi/4.5.1
    /../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lpocketsphinx
    collect2: ld returned 1 exit status
    make: *** Error 1

    i spend a lot of time and try to solve it ,but fail ...... what i know is that
    the sphinxbase and pocketsphinx should fix to
    the version arm-linux-gcc
    because the version of sphinxbase i installed was only fix the PC linux
    so whether should i install the sphinxbase again which fix arm-linux-gcc???
    or how can i install this kind of pocketsphinx?

    thank you for you time ......

     
  • Nickolay V. Shmyrev

    or how can i install this kind of pocketsphinx?

    As I wrote above you need to read cross-compilation documentation to
    understand the basics of cross-compilling software. You also need to read the
    compiler documentation to understand how compiler works and what all those
    flags like -L mean. The command line you are currently using is not correct,
    once you read the documentation you will be able to fix it.

     
  • Jolyxie

    Jolyxie - 2012-05-03

    oh ~~yes~~i will !!
    thanks a lot

     

Log in to post a comment.