PocketSphinx  0.6
ngram_search_s Struct Reference

N-Gram search module structure. More...

#include <ngram_search.h>

Data Fields

ps_search_t base
 
ngram_model_t * lmset
 Set of language models. More...
 
hmm_context_thmmctx
 HMM context. More...
 
uint8 fwdtree
 
uint8 fwdflat
 
uint8 bestpath
 
uint8 done
 
listelem_alloc_t * chan_alloc
 For chan_t.
 
listelem_alloc_t * root_chan_alloc
 For root_chan_t.
 
listelem_alloc_t * latnode_alloc
 For latnode_t.
 
root_chan_troot_chan
 Search structure of HMM instances. More...
 
int32 n_root_chan_alloc
 Number of root_chan allocated.
 
int32 n_root_chan
 Number of valid root_chan.
 
int32 n_nonroot_chan
 Number of valid non-root channels.
 
int32 max_nonroot_chan
 Maximum possible number of non-root channels.
 
root_chan_trhmm_1ph
 Root HMMs for single-phone words.
 
chan_t ** word_chan
 Channels associated with a given word (only used for right contexts, single-phone words in fwdtree search, and word HMMs in fwdflat search). More...
 
bitvec_t * word_active
 array of active flags for all words. More...
 
int32 * homophone_set
 Each node in the HMM tree structure may point to a set of words whose last phone would follow that node in the tree structure (but is not included in the tree structure for reasons explained above). More...
 
int32 * single_phone_wid
 list of single-phone word ids
 
int32 n_1ph_words
 Number single phone words in dict (total)
 
int32 n_1ph_LMwords
 Number single phone dict words also in LM; these come first in single_phone_wid.
 
chan_t *** active_chan_list
 Array of active channels for current and next frame. More...
 
int32 n_active_chan [2]
 Number entries in active_chan_list.
 
int32 ** active_word_list
 Array of active multi-phone words for current and next frame. More...
 
int32 n_active_word [2]
 Number entries in active_word_list.
 
lastphn_cand_tlastphn_cand
 
int32 n_lastphn_cand
 
last_ltrans_tlast_ltrans
 
int32 cand_sf_alloc
 
cand_sf_tcand_sf
 
bestbp_rc_tbestbp_rc
 
bptbl_tbp_table
 
int32 bpidx
 
int32 bp_table_size
 
int32 * bscore_stack
 
int32 bss_head
 
int32 bscore_stack_size
 
int32 n_frame_alloc
 Number of frames allocated in bp_table_idx and friends. More...
 
int32 n_frame
 Number of frames actually present. More...
 
int32 * bp_table_idx
 
int32 * word_lat_idx
 
ps_latnode_t ** frm_wordlist
 List of active words in each frame. More...
 
int32 * fwdflat_wordlist
 List of active word IDs for utterance. More...
 
bitvec_t * expand_word_flag
 
int32 * expand_word_list
 
int32 n_expand_words
 
int32 min_ef_width
 
int32 max_sf_win
 
float32 fwdflat_fwdtree_lw_ratio
 
int32 best_score
 Best Viterbi path score. More...
 
int32 last_phone_best_score
 Best Viterbi path score for last phone. More...
 
int32 renormalized
 
float32 bestpath_fwdtree_lw_ratio
 
float32 ascale
 Acoustic score scale for posterior probabilities. More...
 
ngram_search_stats_t st
 Various statistics for profiling. More...
 
ptmr_t fwdtree_perf
 
ptmr_t fwdflat_perf
 
ptmr_t bestpath_perf
 
int32 n_tot_frame
 
int32 beam
 
int32 dynamic_beam
 
int32 pbeam
 
int32 wbeam
 
int32 lpbeam
 
int32 lponlybeam
 
int32 fwdflatbeam
 
int32 fwdflatwbeam
 
int32 fillpen
 
int32 silpen
 
int32 wip
 
int32 nwpen
 
int32 pip
 
int32 maxwpf
 
int32 maxhmmpf
 

Detailed Description

N-Gram search module structure.

Definition at line 197 of file ngram_search.h.

Field Documentation

◆ active_chan_list

chan_t*** ngram_search_s::active_chan_list

Array of active channels for current and next frame.

In any frame, only some HMM tree nodes are active. active_chan_list[f mod 2] = list of nonroot channels in the HMM tree active in frame f.

Definition at line 275 of file ngram_search.h.

◆ active_word_list

int32** ngram_search_s::active_word_list

Array of active multi-phone words for current and next frame.

Similarly to active_chan_list, active_word_list[f mod 2] = list of word ids for which active channels exist in word_chan in frame f.

Statically allocated single-phone words are always active and should not appear in this list.

Definition at line 287 of file ngram_search.h.

◆ ascale

float32 ngram_search_s::ascale

Acoustic score scale for posterior probabilities.

Definition at line 333 of file ngram_search.h.

◆ best_score

int32 ngram_search_s::best_score

Best Viterbi path score.

Definition at line 325 of file ngram_search.h.

◆ frm_wordlist

ps_latnode_t** ngram_search_s::frm_wordlist

List of active words in each frame.

Definition at line 316 of file ngram_search.h.

Referenced by ngram_search_mark_bptable().

◆ fwdflat_wordlist

int32* ngram_search_s::fwdflat_wordlist

List of active word IDs for utterance.

Definition at line 317 of file ngram_search.h.

Referenced by ngram_fwdflat_reinit().

◆ hmmctx

hmm_context_t* ngram_search_s::hmmctx

HMM context.

Definition at line 200 of file ngram_search.h.

Referenced by ngram_search_init().

◆ homophone_set

int32* ngram_search_s::homophone_set

Each node in the HMM tree structure may point to a set of words whose last phone would follow that node in the tree structure (but is not included in the tree structure for reasons explained above).

The channel node points to one word in this set of words. The remaining words are linked through homophone_set[].

Single-phone words are not represented in the HMM tree; they are kept in word_chan.

Specifically, homophone_set[w] = wid of next word in the same set as w.

Definition at line 263 of file ngram_search.h.

◆ last_phone_best_score

int32 ngram_search_s::last_phone_best_score

Best Viterbi path score for last phone.

Definition at line 326 of file ngram_search.h.

◆ lmset

ngram_model_t* ngram_search_s::lmset

Set of language models.

Definition at line 199 of file ngram_search.h.

Referenced by ps_update_lmset().

◆ n_frame

int32 ngram_search_s::n_frame

Number of frames actually present.

Definition at line 308 of file ngram_search.h.

Referenced by ngram_search_find_exit().

◆ n_frame_alloc

int32 ngram_search_s::n_frame_alloc

Number of frames allocated in bp_table_idx and friends.

Definition at line 307 of file ngram_search.h.

Referenced by ngram_search_mark_bptable().

◆ root_chan

root_chan_t* ngram_search_s::root_chan

Search structure of HMM instances.

The word triphone sequences (HMM instances) are transformed into tree structures, one tree per unique left triphone in the entire dictionary (actually diphone, since its left context varies dyamically during the search process). The entire set of trees of channels is allocated once and for all during initialization (since dynamic management of active CHANs is time consuming), with one exception: the last phones of words, that need multiple right context modelling, are not maintained in this static structure since there are too many of them and few are active at any time. Instead they are maintained as linked lists of CHANs, one list per word, and each CHAN in this set is allocated only on demand and freed if inactive.Roots of search tree.

Definition at line 231 of file ngram_search.h.

◆ st

ngram_search_stats_t ngram_search_s::st

Various statistics for profiling.

Definition at line 335 of file ngram_search.h.

◆ word_active

bitvec_t* ngram_search_s::word_active

array of active flags for all words.

Definition at line 247 of file ngram_search.h.

◆ word_chan

chan_t** ngram_search_s::word_chan

Channels associated with a given word (only used for right contexts, single-phone words in fwdtree search, and word HMMs in fwdflat search).

WARNING: For single-phone words and fwdflat search, this actually contains pointers to root_chan_t, which are allocated using root_chan_alloc. This is a suboptimal state of affairs.

Definition at line 246 of file ngram_search.h.

Referenced by ngram_search_free_all_rc().


The documentation for this struct was generated from the following file: