Hi, I found the functions in the API related to NBest list in the pocketsphinx.h as below:
/
* Get an iterator over the best hypotheses, optionally within a
* selected region of the utterance. Iterator is empty now, it must
* be advanced with ps_nbest_next first. The function may also
* return a NULL which means that there is no hypothesis available for this
* utterance.
*
* @param ps Decoder.
* @param sf Start frame for N-best search (0 for whole utterance)
* @param ef End frame for N-best search (-1 for whole utterance)
* @param ctx1 First word of trigram context (NULL for whole utterance)
* @param ctx2 First word of trigram context (NULL for whole utterance)
* @return Iterator over N-best hypotheses or NULL if no hypothesis is available /
POCKETSPHINX_EXPORT
ps_nbest_t ps_nbest(ps_decoder_t ps, int sf, int ef,char const ctx1, char const *ctx2);
There are also some functions else related to the NBest information. I did not find examples about how to use them. I want to print out the N-Best list (also the score) for each frame in the utterance. Could any one give me an example about using it?
Thank you very much!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
However, I found it also contains the code:
TEST_ASSERT(config =
cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/en-us/en-us",
"-lm", MODELDIR "/en-us/en-us.lm.bin",
"-dict", MODELDIR "/en-us/cmudict-en-us.dict",
"-fwdtree", "yes",
"-fwdflat", "yes",
"-bestpath", "yes",
"-input_endian", "little",
"-samprate", "16000", NULL));
TEST_ASSERT(ps = ps_init(config));
TEST_ASSERT(rawfh = fopen(DATADIR "/goforward.raw", "rb"));
ps_decode_raw(ps, rawfh, -1);
It seems it has already been configured (including the input file). If I want to use my own configuration, I have to change the part of "config". If I don't mistake, I can use:
config = cmd_ln_parse_r(NULL, ps_args_def, argc, argv, TRUE);
Then I can pass the parameters from the command line.
Is this correct?
Thank you once again.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I found the functions in the API related to NBest list in the pocketsphinx.h as below:
/
* Get an iterator over the best hypotheses, optionally within a
* selected region of the utterance. Iterator is empty now, it must
* be advanced with ps_nbest_next first. The function may also
* return a NULL which means that there is no hypothesis available for this
* utterance.
*
* @param ps Decoder.
* @param sf Start frame for N-best search (0 for whole utterance)
* @param ef End frame for N-best search (-1 for whole utterance)
* @param ctx1 First word of trigram context (NULL for whole utterance)
* @param ctx2 First word of trigram context (NULL for whole utterance)
* @return Iterator over N-best hypotheses or NULL if no hypothesis is available
/
POCKETSPHINX_EXPORT
ps_nbest_t ps_nbest(ps_decoder_t ps, int sf, int ef,char const ctx1, char const *ctx2);
There are also some functions else related to the NBest information. I did not find examples about how to use them. I want to print out the N-Best list (also the score) for each frame in the utterance. Could any one give me an example about using it?
Thank you very much!
pocketsphinx/test/unit/test_ps_nbest.c:
Thank you! I see it.
However, I found it also contains the code:
TEST_ASSERT(config =
cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/en-us/en-us",
"-lm", MODELDIR "/en-us/en-us.lm.bin",
"-dict", MODELDIR "/en-us/cmudict-en-us.dict",
"-fwdtree", "yes",
"-fwdflat", "yes",
"-bestpath", "yes",
"-input_endian", "little",
"-samprate", "16000", NULL));
TEST_ASSERT(ps = ps_init(config));
TEST_ASSERT(rawfh = fopen(DATADIR "/goforward.raw", "rb"));
ps_decode_raw(ps, rawfh, -1);
It seems it has already been configured (including the input file). If I want to use my own configuration, I have to change the part of "config". If I don't mistake, I can use:
config = cmd_ln_parse_r(NULL, ps_args_def, argc, argv, TRUE);
Then I can pass the parameters from the command line.
Is this correct?
Thank you once again.
Yes