How to get a CTM File from CMU Sphinx?

167 views Asked by At

I have decoded my speech into phonemes by using my language model.I need to segment the speech into sentences and words.I know , a ctm file will help .Can anyone tell me how to generate the ctm file for a particular speech instance ?

1

There are 1 answers

1
Nikolay Shmyrev On

The code to dump word times from the recognizer:

int frame_rate = cmd_ln_int32_r(config, "-frate");
ps_seg_t *iter = ps_seg_iter(ps, NULL);
while (iter != NULL) {
    int32 sf, ef, pprob;
    float conf;

    ps_seg_frames(iter, &sf, &ef);
    pprob = ps_seg_prob(iter, NULL, NULL, NULL);
    conf = logmath_exp(ps_get_logmath(ps), pprob);
    printf("%s %.3f %.3f %f\n", ps_seg_word(iter), ((float)sf / frame_rate),
           ((float) ef / frame_rate), conf);
    iter = ps_seg_next(iter);
}