Menu

intermediate results of the decoding

Help
2018-02-23
2018-02-26
  • Gyozo Karsai

    Gyozo Karsai - 2018-02-23

    Dear 'PocketSphinx' team,
    I would like to transcribe some speech in wav file into text with the help of PocketSphinx. But if the sound file is too long then the result of decoding appears only after having recognized the entire file, that will take a long time. Is it possible to display the intermediate results of the decoding as to have outcomes while the process.

     
    • Nickolay V. Shmyrev

      Sure, it is perfectly possible, it depends a how exactly do you use the library though. Is it Python API or something else.

       
  • Gyozo Karsai

    Gyozo Karsai - 2018-02-26

    Dear 'PocketSphinx' team,
    I use a simple visual C++ code for driving of PocketSphinx. I embed the code of PocketSphinx into visual C++ project and I call the appropriate (I hope) methods for the processing any sound file. There is the current code sniplet:
    int16 adbuf[2048];
    ps_start_utt(ps);
    utt_started = FALSE;

       rawfd = fopen(fname, "rb");  //processed input sound file
        while((k = fread(adbuf, sizeof(int16), 2048, rawfd)) > 0) {
            ps_process_raw(ps, adbuf, k, FALSE, FALSE);
            in_speech = ps_get_in_speech(ps);
            if(in_speech && !utt_started) {
                utt_started = TRUE;
            }
            if(!in_speech && utt_started) {
                ps_end_utt(ps);
                hyp = ps_get_hyp(ps, NULL);
                if(hyp != NULL) {
                  //printf("%s\n", hyp);
                    canalToOut(hyp);  //writing of result of decoding
                }
    
                if(print_times) print_word_times();
                fflush(stdout);
    
                ps_start_utt(ps);
                utt_started = FALSE;
            }
        }
        ps_end_utt(ps);
    
     
    • Nickolay V. Shmyrev

      You can use ps_get_hyp after process_raw to get intermediate result.

      ps_process_raw(ps, adbuf, k, FALSE, FALSE);
      hyp = ps_get_hyp(ps, NULL); // <-- You can get intermediate hypothesis here
      in_speech = ps_get_in_speech(ps);
      if(in_speech && !utt_started) {
          utt_started = TRUE;
      }
      
       
  • Gyozo Karsai

    Gyozo Karsai - 2018-02-26

    Dear 'PocketSphinx' team,
    thanks very much for rapid answer

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.