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.
hmm_context_t * | hmmctx
| HMM context.
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_t * | root_chan
| Search structure of HMM instances.
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_t * | rhmm_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).
bitvec_t * | word_active
| array of active flags for all words.
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).
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.
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.
int32 | n_active_word [2]
| Number entries in active_word_list.
lastphn_cand_t * | lastphn_cand
int32 | n_lastphn_cand
last_ltrans_t * | last_ltrans
int32 | cand_sf_alloc
cand_sf_t * | cand_sf
bestbp_rc_t * | bestbp_rc
bptbl_t * | bp_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.
int32 | n_frame
| Number of frames actually present.
int32 * | bp_table_idx
int32 * | word_lat_idx
ps_latnode_t ** | frm_wordlist
| List of active words in each frame.
int32 * | fwdflat_wordlist
| List of active word IDs for utterance.
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.
int32 | last_phone_best_score
| Best Viterbi path score for last phone.
int32 | renormalized
float32 | bestpath_fwdtree_lw_ratio
float32 | ascale
| Acoustic score scale for posterior probabilities.
ngram_search_stats_t | st
| Various statistics for profiling.
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.

Referenced by ngram_fwdtree_deinit(), and ngram_fwdtree_finish().

## 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.

Referenced by ngram_fwdflat_search(), ngram_fwdflat_start(), ngram_fwdtree_finish(), ngram_search_free(), and ngram_search_init().

## ascale

float32 ngram_search_s::ascale

Acoustic score scale for posterior probabilities.

Definition at line 333 of file ngram_search.h.

## base

ps_search_t ngram_search_s::base

Definition at line 198 of file ngram_search.h.

## beam

int32 ngram_search_s::beam

Definition at line 342 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.

Referenced by ngram_fwdflat_search(), ngram_fwdflat_start(), ngram_fwdtree_search(), ngram_fwdtree_start(), and ngram_search_lattice().

## bestbp_rc

bestbp_rc_t* ngram_search_s::bestbp_rc

Definition at line 298 of file ngram_search.h.

## bestpath

uint8 ngram_search_s::bestpath

Definition at line 205 of file ngram_search.h.

## bestpath_fwdtree_lw_ratio

float32 ngram_search_s::bestpath_fwdtree_lw_ratio

Definition at line 332 of file ngram_search.h.

## bestpath_perf

ptmr_t ngram_search_s::bestpath_perf

Definition at line 338 of file ngram_search.h.

## bp_table

bptbl_t* ngram_search_s::bp_table

Definition at line 300 of file ngram_search.h.

## bp_table_idx

int32* ngram_search_s::bp_table_idx

Definition at line 309 of file ngram_search.h.

## bp_table_size

int32 ngram_search_s::bp_table_size

Definition at line 302 of file ngram_search.h.

## bpidx

int32 ngram_search_s::bpidx

Definition at line 301 of file ngram_search.h.

## bscore_stack

int32* ngram_search_s::bscore_stack

Definition at line 303 of file ngram_search.h.

## bscore_stack_size

int32 ngram_search_s::bscore_stack_size

Definition at line 305 of file ngram_search.h.

## bss_head

int32 ngram_search_s::bss_head

Definition at line 304 of file ngram_search.h.

## cand_sf

cand_sf_t* ngram_search_s::cand_sf

Definition at line 297 of file ngram_search.h.

## cand_sf_alloc

int32 ngram_search_s::cand_sf_alloc

Definition at line 296 of file ngram_search.h.

## chan_alloc

listelem_alloc_t* ngram_search_s::chan_alloc

For chan_t.

Definition at line 211 of file ngram_search.h.

Referenced by ngram_search_alloc_all_rc(), ngram_search_free(), ngram_search_free_all_rc(), and ngram_search_init().

## done

uint8 ngram_search_s::done

Definition at line 208 of file ngram_search.h.

## dynamic_beam

int32 ngram_search_s::dynamic_beam

Definition at line 343 of file ngram_search.h.

## expand_word_flag

bitvec_t* ngram_search_s::expand_word_flag

Definition at line 318 of file ngram_search.h.

## expand_word_list

int32* ngram_search_s::expand_word_list

Definition at line 319 of file ngram_search.h.

## fillpen

int32 ngram_search_s::fillpen

Definition at line 350 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_fwdflat_deinit(), ngram_fwdflat_init(), and ngram_search_mark_bptable().

## fwdflat

uint8 ngram_search_s::fwdflat

Definition at line 204 of file ngram_search.h.

## fwdflat_fwdtree_lw_ratio

float32 ngram_search_s::fwdflat_fwdtree_lw_ratio

Definition at line 323 of file ngram_search.h.

## fwdflat_perf

ptmr_t ngram_search_s::fwdflat_perf

Definition at line 337 of file ngram_search.h.

## 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_deinit(), ngram_fwdflat_init(), ngram_fwdflat_reinit(), and ngram_fwdflat_search().

## fwdflatbeam

int32 ngram_search_s::fwdflatbeam

Definition at line 348 of file ngram_search.h.

## fwdflatwbeam

int32 ngram_search_s::fwdflatwbeam

Definition at line 349 of file ngram_search.h.

## fwdtree

uint8 ngram_search_s::fwdtree

Definition at line 203 of file ngram_search.h.

## fwdtree_perf

ptmr_t ngram_search_s::fwdtree_perf

Definition at line 336 of file ngram_search.h.

## hmmctx

hmm_context_t* ngram_search_s::hmmctx

HMM context.

Definition at line 200 of file ngram_search.h.

Referenced by ngram_fwdflat_search(), ngram_search_alloc_all_rc(), ngram_search_free(), and 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_ltrans

last_ltrans_t* ngram_search_s::last_ltrans

Definition at line 295 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.

## lastphn_cand

lastphn_cand_t* ngram_search_s::lastphn_cand

Definition at line 293 of file ngram_search.h.

## latnode_alloc

listelem_alloc_t* ngram_search_s::latnode_alloc

For latnode_t.

Definition at line 213 of file ngram_search.h.

Referenced by ngram_search_free(), and ngram_search_init().

## lmset

ngram_model_t* ngram_search_s::lmset

Set of language models.

Definition at line 199 of file ngram_search.h.

Referenced by ngram_search_free(), and ngram_search_init().

## lpbeam

int32 ngram_search_s::lpbeam

Definition at line 346 of file ngram_search.h.

## lponlybeam

int32 ngram_search_s::lponlybeam

Definition at line 347 of file ngram_search.h.

## max_nonroot_chan

int32 ngram_search_s::max_nonroot_chan

Maximum possible number of non-root channels.

Definition at line 235 of file ngram_search.h.

Referenced by ngram_fwdtree_deinit().

## max_sf_win

int32 ngram_search_s::max_sf_win

Definition at line 322 of file ngram_search.h.

## maxhmmpf

int32 ngram_search_s::maxhmmpf

Definition at line 356 of file ngram_search.h.

## maxwpf

int32 ngram_search_s::maxwpf

Definition at line 355 of file ngram_search.h.

## min_ef_width

int32 ngram_search_s::min_ef_width

Definition at line 321 of file ngram_search.h.

## n_1ph_LMwords

int32 ngram_search_s::n_1ph_LMwords

Number single phone dict words also in LM; these come first in single_phone_wid.

Definition at line 266 of file ngram_search.h.

## n_1ph_words

int32 ngram_search_s::n_1ph_words

Number single phone words in dict (total)

Definition at line 265 of file ngram_search.h.

Referenced by ngram_fwdflat_start(), and ngram_fwdtree_start().

## n_active_chan

int32 ngram_search_s::n_active_chan[2]

Number entries in active_chan_list.

Definition at line 276 of file ngram_search.h.

Referenced by ngram_fwdtree_finish(), and ngram_fwdtree_start().

## n_active_word

int32 ngram_search_s::n_active_word[2]

Number entries in active_word_list.

Definition at line 288 of file ngram_search.h.

Referenced by ngram_fwdflat_search(), ngram_fwdflat_start(), ngram_fwdtree_finish(), and ngram_fwdtree_start().

## n_expand_words

int32 ngram_search_s::n_expand_words

Definition at line 320 of file ngram_search.h.

## 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_fwdflat_search(), ngram_fwdflat_start(), ngram_fwdtree_search(), ngram_fwdtree_start(), ngram_search_find_exit(), and ngram_search_lattice().

## 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_fwdflat_init(), ngram_search_init(), and ngram_search_mark_bptable().

## n_lastphn_cand

int32 ngram_search_s::n_lastphn_cand

Definition at line 294 of file ngram_search.h.

## n_nonroot_chan

int32 ngram_search_s::n_nonroot_chan

Number of valid non-root channels.

Definition at line 234 of file ngram_search.h.

## n_root_chan

int32 ngram_search_s::n_root_chan

Number of valid root_chan.

Definition at line 233 of file ngram_search.h.

Referenced by ngram_fwdtree_finish().

## n_root_chan_alloc

int32 ngram_search_s::n_root_chan_alloc

Number of root_chan allocated.

Definition at line 232 of file ngram_search.h.

## n_tot_frame

int32 ngram_search_s::n_tot_frame

Definition at line 339 of file ngram_search.h.

## nwpen

int32 ngram_search_s::nwpen

Definition at line 353 of file ngram_search.h.

## pbeam

int32 ngram_search_s::pbeam

Definition at line 344 of file ngram_search.h.

## pip

int32 ngram_search_s::pip

Definition at line 354 of file ngram_search.h.

## renormalized

int32 ngram_search_s::renormalized

Definition at line 327 of file ngram_search.h.

## rhmm_1ph

root_chan_t* ngram_search_s::rhmm_1ph

Root HMMs for single-phone words.

Definition at line 236 of file ngram_search.h.

## 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.

Referenced by ngram_fwdtree_finish().

## root_chan_alloc

listelem_alloc_t* ngram_search_s::root_chan_alloc

For root_chan_t.

Definition at line 212 of file ngram_search.h.

Referenced by ngram_search_free(), and ngram_search_init().

## silpen

int32 ngram_search_s::silpen

Definition at line 351 of file ngram_search.h.

## single_phone_wid

int32* ngram_search_s::single_phone_wid

list of single-phone word ids

Definition at line 264 of file ngram_search.h.

Referenced by ngram_fwdflat_start(), and ngram_fwdtree_start().

## st

ngram_search_stats_t ngram_search_s::st

Various statistics for profiling.

Definition at line 335 of file ngram_search.h.

Referenced by ngram_fwdflat_finish(), ngram_fwdflat_search(), ngram_fwdflat_start(), ngram_fwdtree_finish(), ngram_fwdtree_search(), and ngram_fwdtree_start().

## wbeam

int32 ngram_search_s::wbeam

Definition at line 345 of file ngram_search.h.

## wip

int32 ngram_search_s::wip

Definition at line 352 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.

Referenced by ngram_fwdflat_finish(), ngram_fwdflat_search(), ngram_fwdtree_finish(), ngram_search_free(), and ngram_search_init().

## 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_fwdflat_reinit(), ngram_fwdflat_start(), ngram_fwdtree_finish(), ngram_fwdtree_reinit(), ngram_fwdtree_start(), ngram_search_alloc_all_rc(), ngram_search_free(), ngram_search_free_all_rc(), and ngram_search_init().

## word_lat_idx

int32* ngram_search_s::word_lat_idx

Definition at line 310 of file ngram_search.h.

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

- src/libpocketsphinx/ngram_search.h