PocketSphinx 5prealpha
|
N-Gram based multi-pass search ("FBS") More...
#include <string.h>
#include <assert.h>
#include <sphinxbase/ckd_alloc.h>
#include <sphinxbase/listelem_alloc.h>
#include <sphinxbase/err.h>
#include "pocketsphinx_internal.h"
#include "ps_lattice_internal.h"
#include "ngram_search.h"
#include "ngram_search_fwdtree.h"
#include "ngram_search_fwdflat.h"
Go to the source code of this file.
Macros | |
#define | NGRAM_HISTORY_LONG_WORD 2000 /* 20s */ |
Functions | |
ps_search_t * | ngram_search_init (const char *name, ngram_model_t *lm, cmd_ln_t *config, acmod_t *acmod, dict_t *dict, dict2pid_t *d2p) |
Initialize the N-Gram search module. More... | |
void | ngram_search_free (ps_search_t *search) |
Finalize the N-Gram search module. More... | |
int | ngram_search_mark_bptable (ngram_search_t *ngs, int frame_idx) |
Record the current frame's index in the backpointer table. More... | |
void | ngram_search_save_bp (ngram_search_t *ngs, int frame_idx, int32 w, int32 score, int32 path, int32 rc) |
Enter a word in the backpointer table. More... | |
int | ngram_search_find_exit (ngram_search_t *ngs, int frame_idx, int32 *out_best_score) |
Find the best word exit for the current frame in the backpointer table. More... | |
char const * | ngram_search_bp_hyp (ngram_search_t *ngs, int bpidx) |
Backtrace from a given backpointer index to obtain a word hypothesis. More... | |
void | ngram_search_alloc_all_rc (ngram_search_t *ngs, int32 w) |
Allocate last phone channels for all possible right contexts for word w. More... | |
void | ngram_search_free_all_rc (ngram_search_t *ngs, int32 w) |
Allocate last phone channels for all possible right contexts for word w. More... | |
int32 | ngram_search_exit_score (ngram_search_t *ngs, bptbl_t *pbe, int rcphone) |
Get the exit score for a backpointer entry with a given right context. More... | |
void | ngram_compute_seg_score (ngram_search_t *ngs, bptbl_t *be, float32 lwf, int32 *out_ascr, int32 *out_lscr) |
void | dump_bptable (ngram_search_t *ngs) |
ps_lattice_t * | ngram_search_lattice (ps_search_t *search) |
Construct a word lattice from the current hypothesis. More... | |
void | ngram_search_set_lm (ngram_model_t *lm) |
Sets the global language model. More... | |
N-Gram based multi-pass search ("FBS")
Definition in file ngram_search.c.
#define NGRAM_HISTORY_LONG_WORD 2000 /* 20s */ |
Definition at line 380 of file ngram_search.c.
void dump_bptable | ( | ngram_search_t * | ngs | ) |
Definition at line 756 of file ngram_search.c.
void ngram_compute_seg_score | ( | ngram_search_t * | ngs, |
bptbl_t * | be, | ||
float32 | lwf, | ||
int32 * | out_ascr, | ||
int32 * | out_lscr | ||
) |
Definition at line 685 of file ngram_search.c.
void ngram_search_alloc_all_rc | ( | ngram_search_t * | ngs, |
int32 | w | ||
) |
Allocate last phone channels for all possible right contexts for word w.
Definition at line 598 of file ngram_search.c.
char const * ngram_search_bp_hyp | ( | ngram_search_t * | ngs, |
int | bpidx | ||
) |
Backtrace from a given backpointer index to obtain a word hypothesis.
Definition at line 550 of file ngram_search.c.
int32 ngram_search_exit_score | ( | ngram_search_t * | ngs, |
bptbl_t * | pbe, | ||
int | rcphone | ||
) |
Get the exit score for a backpointer entry with a given right context.
Definition at line 660 of file ngram_search.c.
References dict2pid_rssid, bptbl_s::last2_phone, and bptbl_s::score.
int ngram_search_find_exit | ( | ngram_search_t * | ngs, |
int | frame_idx, | ||
int32 * | out_best_score | ||
) |
Find the best word exit for the current frame in the backpointer table.
Definition at line 506 of file ngram_search.c.
References ngram_search_s::n_frame.
void ngram_search_free | ( | ps_search_t * | search | ) |
Finalize the N-Gram search module.
Definition at line 289 of file ngram_search.c.
References ngram_fwdflat_deinit(), and ngram_fwdtree_deinit().
void ngram_search_free_all_rc | ( | ngram_search_t * | ngs, |
int32 | w | ||
) |
Allocate last phone channels for all possible right contexts for word w.
Definition at line 647 of file ngram_search.c.
References ngram_search_s::chan_alloc, chan_s::hmm, hmm_deinit(), chan_s::next, and ngram_search_s::word_chan.
ps_search_t * ngram_search_init | ( | const char * | name, |
ngram_model_t * | lm, | ||
cmd_ln_t * | config, | ||
acmod_t * | acmod, | ||
dict_t * | dict, | ||
dict2pid_t * | d2p | ||
) |
Initialize the N-Gram search module.
Definition at line 140 of file ngram_search.c.
References acmod_set_grow(), and ps_search_init().
Referenced by ps_set_lm().
ps_lattice_t * ngram_search_lattice | ( | ps_search_t * | search | ) |
Construct a word lattice from the current hypothesis.
Definition at line 1215 of file ngram_search.c.
int ngram_search_mark_bptable | ( | ngram_search_t * | ngs, |
int | frame_idx | ||
) |
Record the current frame's index in the backpointer table.
Definition at line 329 of file ngram_search.c.
References ngram_search_s::frm_wordlist, and ngram_search_s::n_frame_alloc.
void ngram_search_save_bp | ( | ngram_search_t * | ngs, |
int | frame_idx, | ||
int32 | w, | ||
int32 | score, | ||
int32 | path, | ||
int32 | rc | ||
) |
Enter a word in the backpointer table.
Definition at line 383 of file ngram_search.c.
void ngram_search_set_lm | ( | ngram_model_t * | lm | ) |
Sets the global language model.
Sets the language model to use if nothing was passed in configuration
Definition at line 1403 of file ngram_search.c.