libsent/include/sent/hmm.h File Reference

Hidden Marcov Model for recognition. More...

#include <sent/stddefs.h>
#include <sent/htk_hmm.h>
#include <sent/htk_param.h>

Include dependency graph for hmm.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _a_cell
 Transition arc of HMM state. More...
struct  HMM_STATE
 HMM State More...
struct  HMM
 HMM state sequence More...
struct  _seg_token

Typedefs

typedef _a_cell A_CELL
 Transition arc of HMM state.
typedef _seg_token SEGTOKEN

Functions

HMMnew_make_word_hmm (HTK_HMM_INFO *, HMM_Logical **, int)
HMMnew_make_word_hmm_with_lm (HTK_HMM_INFO *, HMM_Logical **, int, LOGPROB *)
void free_hmm (HMM *)
LOGPROB viterbi_segment (HMM *hmm, HTK_Param *param, int *endstates, int ulen, int **id_ret, int **seg_ret, LOGPROB **uscore_ret, int *retlen)
 Perform Viterbi alignment.
void make_log_tbl ()
 Generate a value tables of $\log (1+e^x)$.
LOGPROB addlog (LOGPROB x, LOGPROB y)
LOGPROB addlog_array (LOGPROB *x, int n)
boolean outprob_init (HTK_HMM_INFO *hmminfo, HTK_HMM_INFO *gshmm, int gms_num, int gprune_method, int gprune_mixnum)
boolean outprob_prepare (int framenum)
void outprob_free ()
boolean outprob_cache_init ()
boolean outprob_cache_prepare ()
void outprob_cache_free ()
LOGPROB outprob_state (int t, HTK_HMM_State *stateinfo, HTK_Param *param)
 Compute output probability of a state.
void outprob_cd_nbest_init (int num)
void outprob_cd_nbest_free ()
LOGPROB outprob_cd (int t, CD_State_Set *lset, HTK_Param *param)
LOGPROB outprob (int t, HMM_STATE *hmmstate, HTK_Param *param)
boolean gms_init (int nbest)
boolean gms_prepare (int framelen)
void gms_free ()
LOGPROB gms_state ()
void gms_gprune_init (HTK_HMM_INFO *hmminfo, int gsset_num)
void gms_gprune_prepare ()
void gms_gprune_free ()
void compute_gs_scores (GS_SET *gsset, int gsset_num, LOGPROB *scores_ret)
LOGPROB calc_mix ()
 Compute the output probability of current state OP_State.
boolean calc_tied_mix_init ()
boolean calc_tied_mix_prepare (int framenum)
void calc_tied_mix_free ()
LOGPROB calc_tied_mix ()
 Compute the output probability of current state OP_State on tied-mixture model.
void put_hmm_arc (HMM *d)
void put_hmm_outprob (HMM *d)
void put_hmm (HMM *d)


Detailed Description

Hidden Marcov Model for recognition.

Author:
Akinobu LEE
Date:
Thu Feb 10 14:54:06 2005
This file defines HMM instance structure for recognition. When recognition, the required word HMM or tree lexicon will be built using these structures referencing word dictionary and HTK HMM Acoustic Model (defined in htk_hmm.h), and actual likelihood computation.

Revision
1.4

Definition in file hmm.h.


Typedef Documentation

typedef struct _seg_token SEGTOKEN

Token definition for viterbi segmentation.


Function Documentation

HMM* new_make_word_hmm ( HTK_HMM_INFO hmminfo,
HMM_Logical **  hdseq,
int  hdseqlen 
)

Make a HMM instance for recognition from phoneme sequence.

Parameters:
hmminfo [in] HTK HMM definitions data
hdseq [in] phoneme sequence as given by pointer list of logical HMM
hdseqlen [in] length of above
Returns:
newly allocated HMM instance generated from the given data.

Definition at line 362 of file mkwhmm.c.

Referenced by do_align(), and scan_word().

HMM* new_make_word_hmm_with_lm ( HTK_HMM_INFO hmminfo,
HMM_Logical **  hdseq,
int  hdseqlen,
LOGPROB lscore 
)

Make a HMM instance for recognition from phoneme sequence, with connection probabiliry given for each phoneme.

Parameters:
hmminfo [in] HTK HMM definitions data
hdseq [in] phoneme sequence as given by pointer list of logical HMM
hdseqlen [in] length of above
lscore [in] list of log probability to be added at the emitting transition of each phoneme, or NULL if not needed.
Returns:
newly allocated HMM instance generated from the given data.

Definition at line 102 of file mkwhmm.c.

Referenced by new_make_word_hmm().

void free_hmm ( HMM d  ) 

Free an HMM instance.

Parameters:
d [in] HMM instance to free

Definition at line 381 of file mkwhmm.c.

LOGPROB viterbi_segment ( HMM hmm,
HTK_Param param,
int *  endstates,
int  ulen,
int **  id_ret,
int **  seg_ret,
LOGPROB **  uscore_ret,
int *  slen_ret 
)

Perform Viterbi alignment.

This function performs viterbi alignment for the given sentence HMM, input parameter and unit definition. Any segmentatino unit (word, phoneme state, etc.) is allowed: the segmentation unit should be specified by specifying a list of state id which are the end of each unit. For example, if you want to obtain phoneme alignment, the list of state number that exist at the end of phones should be specified by endstates.

Parameters:
hmm [in] sentence HMM to be matched
param [in] input parameter data
endstates [in] list of state id that corrsponds to the ends of units
ulen [in] total number of units in the hmm
id_ret [out] Pointer to store the newly allocated array of the resulting id sequence of units on the best path.
seg_ret [out] Pointer to store the newly allocated array of the resulting end frame of each unit on the best path.
uscore_ret [out] Pointer to store the newly allocated array of the resulting score at the end frame of each unit on the best path.
slen_ret [out] Pointer to store the total number of units on the best path.
Returns:
the total acoustic score for the whole input.

Definition at line 50 of file vsegment.c.

Referenced by do_align().

void make_log_tbl (  ) 

Generate a value tables of $\log (1+e^x)$.

$x$ is from 0 to (- VRANGE), and table size is TBLSIZE.

Definition at line 41 of file addlog.c.

Referenced by outprob_init().

LOGPROB addlog ( LOGPROB  x,
LOGPROB  y 
)

Rapid computation of $\log (e^x + e^y)$.

If value differs more than LOG_ADDMIN, the larger value will be returned as is.

Parameters:
x [in] log value
y [in] log value
Returns:
result value.

Definition at line 70 of file addlog.c.

LOGPROB addlog_array ( LOGPROB a,
int  n 
)

Rapid computation of $\log (\sum_{i=1}^N e^{x_i})$.

Parameters:
a [in] array of log values
n [in] length of above
Returns:
the result value.

Definition at line 102 of file addlog.c.

Referenced by calc_mix(), calc_tied_mix(), and gmm_calc_mix().

boolean outprob_init ( HTK_HMM_INFO hmminfo,
HTK_HMM_INFO gshmm,
int  gms_num,
int  gprune_method,
int  gprune_mixnum 
)

Initialize and setup acoustic computation functions.

Returns:
TRUE on success, FALSE on failure.

select functions

Definition at line 62 of file outprob_init.c.

Referenced by final_fusion().

boolean outprob_prepare ( int  framenum  ) 

Prepare for the next input of given frame length.

Parameters:
framenum [in] input length in frame.
Returns:
TRUE on success, FALSE on failure.

Definition at line 158 of file outprob_init.c.

Referenced by main_recognition_loop(), and RealTimePipeLinePrepare().

void outprob_free (  ) 

Free all work area for outprob computation.

Definition at line 177 of file outprob_init.c.

boolean outprob_cache_init (  ) 

Initialize the cache data, should be called once on startup.

Returns:
TRUE on success, FALSE on failure.

Definition at line 82 of file outprob.c.

Referenced by outprob_init().

boolean outprob_cache_prepare (  ) 

Prepare cache for the next input, by clearing the existing cache.

Returns:
TRUE on success, FALSE on failure.

Definition at line 100 of file outprob.c.

Referenced by outprob_prepare().

void outprob_cache_free (  ) 

Free work area for cache.

Definition at line 159 of file outprob.c.

Referenced by outprob_free().

LOGPROB outprob_state ( int  t,
HTK_HMM_State stateinfo,
HTK_Param param 
)

Compute output probability of a state.

Set the needed values to the global variables that begins with "OP_", and call calc_outprob_state(). The calc_outprob_state() is actually a function pointer, and the entity is either calc_tied_mix() for tied-mixture model and calc_mix() for others. (If you use GMS, the entity will be gms_state() instead.)

The state-level cache is also consulted here.

Returns:
output log probability.

Definition at line 180 of file outprob.c.

Referenced by outprob(), outprob_cd_avg(), outprob_cd_max(), outprob_cd_nbest(), outprob_style(), and start_word().

void outprob_cd_nbest_init ( int  num  ) 

Initialize work area for outprob_cd_nbest().

Parameters:
num [in] number of top states to be calculated.

Definition at line 217 of file outprob.c.

Referenced by outprob_init().

void outprob_cd_nbest_free (  ) 

Free work area for outprob_cd_nbest().

Definition at line 228 of file outprob.c.

Referenced by outprob_free().

LOGPROB outprob_cd ( int  t,
CD_State_Set lset,
HTK_Param param 
)

Compute the log output probability of a pseudo state set.

Parameters:
t [in] input frame
lset [in] pseudo state set
param [in] input parameter data
Returns:
the computed log output probability.

Definition at line 335 of file outprob.c.

Referenced by outprob(), outprob_style(), and start_word().

LOGPROB outprob ( int  t,
HMM_STATE hmmstate,
HTK_Param param 
)

Top function to compute the output probability of a HMM state.

Parameters:
t [in] input frame
hmmstate [in] HMM state
param [in] input parameter data
Returns:
the computed log output probability.

Definition at line 369 of file outprob.c.

Referenced by scan_word(), and viterbi_segment().

boolean gms_init ( int  nbest  ) 

Initialize the GMS related functions and data.

Parameters:
nbest [in] N-best state to compute the precise triphone.
Returns:
TRUE on success, FALSE on failure.

Definition at line 282 of file gms.c.

Referenced by outprob_init().

boolean gms_prepare ( int  framenum  ) 

Setup GMS parameters for next input.

Parameters:
framenum [in] length of next input in frames
Returns:
TRUE on success, FALSE on failure.

Definition at line 332 of file gms.c.

Referenced by outprob_prepare().

void gms_free (  ) 

Free GMS related work areas.

Definition at line 366 of file gms.c.

Referenced by outprob_free().

LOGPROB gms_state (  ) 

Get HMM State probability of current state with Gaussiam Mixture Selection.

If the GMS HMM score of the corresponding basephone is below the N-best, the triphone score will not be computed, and the score of the GMS HMM will be returned instead as a fallback score. Else, the precise triphone will be computed and returned.

Returns:
the state output probability score in log10.

Definition at line 392 of file gms.c.

Referenced by outprob_init().

void gms_gprune_init ( HTK_HMM_INFO hmminfo,
int  gsset_num 
)

Initialization of GMS HMM likelihood computation.

Parameters:
hmminfo [in] GMS HMM definition
gsset_num [in] number of states in GMS HMM

Definition at line 60 of file gms_gprune.c.

Referenced by gms_init().

void gms_gprune_prepare (  ) 

Prepare GMS HMM computation for the next speech input.

Definition at line 75 of file gms_gprune.c.

Referenced by gms_prepare().

void gms_gprune_free (  ) 

Free GMS related work area.

Definition at line 88 of file gms_gprune.c.

Referenced by gms_free().

void compute_gs_scores ( GS_SET gsset,
int  gsset_num,
LOGPROB scores_ret 
)

Main function to compute all the GMS HMM states in a frame with the input vectore specified by OP_vec. This function assumes that this will be called for sequencial frame, since it utilizes the result of previous frame for faster pruning.

Parameters:
gsset [in] list of GMS HMM state set.
gsset_num [in] length of above
scores_ret [out] array of scores for each GMS HMM state

Definition at line 306 of file gms_gprune.c.

Referenced by do_gms().

LOGPROB calc_mix (  ) 

Compute the output probability of current state OP_State.

No codebook-level cache is done.

Returns:
the output probability of the state OP_State in log10

Definition at line 39 of file calc_mix.c.

Referenced by outprob_init().

boolean calc_tied_mix_init (  ) 

Initialize codebook cache area.

Returns:
TRUE on success, FALSE on failure.

Definition at line 57 of file calc_tied_mix.c.

Referenced by outprob_init().

boolean calc_tied_mix_prepare ( int  framenum  ) 

Setup codebook cache for the next incoming input.

Parameters:
framenum [in] length of the next input.
Returns:
TRUE on success, FALSE on failure.

Definition at line 73 of file calc_tied_mix.c.

Referenced by outprob_prepare().

void calc_tied_mix_free (  ) 

Free work area for tied-mixture calculation.

Definition at line 113 of file calc_tied_mix.c.

Referenced by outprob_free().

LOGPROB calc_tied_mix (  ) 

Compute the output probability of current state OP_State on tied-mixture model.

This function assumes that the OP_state is assigned to a tied-mixture codebook. Here the output probability of Gaussian mixture component referred by OP_state is consulted to the book level cache, and if not computed yet on that input frame time, it will be computed here.

Returns:
the computed output probability in log10.

Definition at line 138 of file calc_tied_mix.c.

Referenced by outprob_init().

void put_hmm_arc ( HMM d  ) 

Output transition arcs of an HMM instance.

Parameters:
d [in] pointer to a HMM instance.

Definition at line 160 of file put_htkdata_info.c.

Referenced by put_hmm().

void put_hmm_outprob ( HMM d  ) 

Output output probability information of an HMM instance.

Parameters:
d [in] pointer to a HMM instance.

Definition at line 183 of file put_htkdata_info.c.

Referenced by put_hmm().

void put_hmm ( HMM d  ) 

Output an HMM instance.

Parameters:
d [in] pointer to a HMM instance.

Definition at line 204 of file put_htkdata_info.c.


Generated on Tue Dec 26 16:17:05 2006 for Julius by  doxygen 1.5.0