📄 htk_hmm.h
字号:
HTK_HMM_Trans *tr; ///< Transition matrix struct _cd_set *next; ///< Pointer to next data, NULL if last} CD_Set;/// Top structure to hold all the %HMM setstypedef struct { APATNODE *cdtree; ///< Root of index tree for name lookup} HMM_CDSET_INFO;//@}/** * @ingroup cdset * * @brief Logical %HMM to map logical names to physical/pseudo %HMM * * This data maps logical %HMM name to physical (defined) %HMM or pseudo %HMM. * The logical %HMM names are basically loaded from %HMMList mapping file. * Biphone/monophone %HMM names, not listed in the %HMMList file, * are mapped to pseudo phones, which represents the context-dependent %HMM * set. * * For example, if logical biphone %HMM name "e-k" is defined in %HMM definition * file or its mapping is specified in the HMMList file, the Logical %HMM name * "e-k" will be mapped to the corresponding defined %HMM. * If "e-k" does not exist in * both %HMM definition file and HMMList file, triphones whose name matches * "e-k+*" will be gathered to phone context-dependent %HMM set "e-k", and * the logical %HMM name "e-k" will be mapped to this %HMM set. * * The context-dependent %HMM is also called a "pseudo" phone in Julius. * */typedef struct _HMM_logical { char *name; ///< Name string of this logical %HMM boolean is_pseudo; ///< TRUE if this is mapped to pseudo %HMM /// Actual body of state definition union { HTK_HMM_Data *defined; ///< pointer to the mapped physical %HMM CD_Set *pseudo; ///< pointer to the mapped pseudo %HMM } body; struct _HMM_logical *next; ///< Pointer to next data, NULL if last} HMM_Logical;/** * @ingroup hmminfo * * @brief Basephone information extracted from hmminfo */typedef struct { char *name; ///< Base phone name boolean bgnflag; ///< TRUE if it can appear on word beginning determined by word dictionary boolean endflag; ///< TRUE if it can appear on word end determined by word dictionary} BASEPHONE;/** * @ingroup hmminfo * * @brief List of all basephone in hmminfo */typedef struct { int num; ///< Total number of base phone int bgnnum; ///< Number of phones that can appear on word beginning int endnum; ///< Number of phones that can appear on word end APATNODE *root; ///< Root of index tree for name lookup} HMM_basephone;/** * @ingroup hmminfo * * @brief Top %HMM structure that holds all the HTK %HMM definition */typedef struct { /** * @name %HMM definitions from hmmdefs */ //@{ HTK_HMM_Options opt; ///< Global option HTK_HMM_Trans *trstart; ///< Root pointer to the list of transition matrixes HTK_HMM_Var *vrstart; ///< Root pointer to the list of variance data HTK_HMM_Dens *dnstart; ///< Root pointer to the list of density (mixture) data HTK_HMM_State *ststart; ///< Root pointer to the list of state data HTK_HMM_Data *start; ///< Root pointer to the list of models //@} /** * @name logical %HMM */ //@{ HMM_Logical *lgstart; ///< Root pointer to the list of Logical %HMMs //@} /** * @name Root nodes of index tree for name lookup of %HMM instances */ //@{ APATNODE *tr_root; ///< Root index node for transition matrixes APATNODE *vr_root; ///< Root index node for variance data APATNODE *dn_root; ///< Root index node for density data APATNODE *st_root; ///< Root index node for state data APATNODE *physical_root; ///< Root index node for defined %HMM name APATNODE *logical_root; ///< Root index node for logical %HMM name APATNODE *codebook_root; ///< Root index node for Gaussian codebook of tied mixture %HMM //@} /** * @name Information extracted from %HMM instances */ //@{ HMM_basephone basephone; ///< Base phone names extracted from logical %HMM HMM_CDSET_INFO cdset_info; ///< Context-dependent pseudo phone set //@} /** * @name Misc. model information */ //@{ boolean is_triphone; ///< TRUE if this is triphone model boolean is_tied_mixture; ///< TRUE if this is tied-mixture model short cdset_method; ///< Selected method of computing pseudo phones in iwcd_type short cdmax_num; ///< Number of N-best states when IWCD_NBEST HMM_Logical *sp; ///< Link to short pause model#ifdef MULTIPATH_VERSION LOGPROB iwsp_penalty; ///< Extra ransition penalty for interword skippable short pause insertion#endif boolean variance_inversed; ///< TRUE if variances are inversed int totalmixnum; ///< Total number of defined mixtures int totalstatenum; ///< Total number of states int totalhmmnum; ///< Total number of physical %HMM int totallogicalnum; ///< Total number of logical %HMM int totalpseudonum; ///< Total number of pseudo %HMM int codebooknum; ///< Total number of codebook on tied-mixture model int maxcodebooksize; ///< Maximum size of codebook on tied-mixture model int maxmixturenum; ///< Maximum number of Gaussian per mixture int maxstatenum; ///< Maximum number of state per model BMALLOC_BASE *mroot; ///< Pointer for block memory allocation BMALLOC_BASE *lroot; ///< Pointer for block memory allocation for logical HMM //@}} HTK_HMM_INFO;/* init_phmm.c */void htk_hmm_set_pause_model(HTK_HMM_INFO *hmminfo, char *spmodel_name);/* rdhmmdef.c */void rderr(char *str);char *read_token(FILE *fp);boolean rdhmmdef(FILE *, HTK_HMM_INFO *);void htk_hmm_inverse_variances(HTK_HMM_INFO *hmm);/* rdhmmdef_options.c */void set_global_opt(FILE *fp, HTK_HMM_INFO *hmm);char *get_cov_str(short covtype);char *get_dur_str(short durtype);/* rdhmmdef_trans.c */void trans_add(HTK_HMM_INFO *hmm, HTK_HMM_Trans *new);HTK_HMM_Trans *get_trans_data(FILE *, HTK_HMM_INFO *);void def_trans_macro(char *, FILE *, HTK_HMM_INFO *);/* rdhmmdef_state.c */HTK_HMM_State *get_state_data(FILE *, HTK_HMM_INFO *);void def_state_macro(char *, FILE *, HTK_HMM_INFO *);HTK_HMM_State *state_lookup(HTK_HMM_INFO *hmm, char *keyname);void state_add(HTK_HMM_INFO *hmm, HTK_HMM_State *new);/* rdhmmdef_dens.c */HTK_HMM_Dens *get_dens_data(FILE *, HTK_HMM_INFO *);void def_dens_macro(char *, FILE *, HTK_HMM_INFO *);HTK_HMM_Dens *dens_lookup(HTK_HMM_INFO *hmm, char *keyname);void dens_add(HTK_HMM_INFO *hmm, HTK_HMM_Dens *new);/* rdhmmdef_var.c */HTK_HMM_Var *get_var_data(FILE *, HTK_HMM_INFO *);void def_var_macro(char *, FILE *, HTK_HMM_INFO *);void var_add(HTK_HMM_INFO *hmm, HTK_HMM_Var *new);/* rdhmmdef_data.c */void def_HMM(char *, FILE *, HTK_HMM_INFO *);HTK_HMM_Data *htk_hmmdata_new(HTK_HMM_INFO *);void htk_hmmdata_add(HTK_HMM_INFO *hmm, HTK_HMM_Data *new);/* rdhmmdef_tiedmix.c */void tmix_read(FILE *fp, HTK_HMM_State *state, HTK_HMM_INFO *hmm);void codebook_add(HTK_HMM_INFO *hmm, GCODEBOOK *new);/* rdhmmdef_regtree.c */void def_regtree_macro(char *name, FILE *fp, HTK_HMM_INFO *hmm);/* rdhmmdef_hmmlist.c */boolean rdhmmlist(FILE *fp, HTK_HMM_INFO *hmminfo);/* put_htkdata_info.c */void put_htk_trans(HTK_HMM_Trans *t);void put_htk_var(HTK_HMM_Var *v);void put_htk_dens(HTK_HMM_Dens *d);void put_htk_state(HTK_HMM_State *s);void put_htk_hmm(HTK_HMM_Data *h);void put_logical_hmm(HMM_Logical *l);void print_hmmdef_info(HTK_HMM_INFO *);HTK_HMM_INFO *hmminfo_new();boolean hmminfo_free(HTK_HMM_INFO *);void init_hmminfo(HTK_HMM_INFO *hmminfo, char *filename, char *mapfile, Value *para);HTK_HMM_Data *htk_hmmdata_lookup_physical(HTK_HMM_INFO *, char *);HMM_Logical *htk_hmmdata_lookup_logical(HTK_HMM_INFO *, char *);void hmm_add_physical_to_logical(HTK_HMM_INFO *);void hmm_add_pseudo_phones(HTK_HMM_INFO *hmminfo);/* chkhmmlist.c */void make_hmm_basephone_list(HTK_HMM_INFO *hmminfo);/* HMM type check functions */boolean check_hmm_limit(HTK_HMM_Data *dt);boolean check_all_hmm_limit(HTK_HMM_INFO *hmm);boolean check_hmm_options(HTK_HMM_INFO *hmm);#ifdef MULTIPATH_VERSIONboolean is_skippable_model(HTK_HMM_Data *d);#endif/* CCD related */boolean guess_if_cd_hmm(HTK_HMM_INFO *hmm);HMM_Logical *get_right_context_HMM(HMM_Logical *base, char *rc_name, HTK_HMM_INFO *hmminfo);HMM_Logical *get_left_context_HMM(HMM_Logical *base, char *lc_name, HTK_HMM_INFO *hmminfo);void add_right_context(char name[], char *rc);void add_left_context(char name[], char *lc);char *center_name(char *hmmname, char *buf);char *leftcenter_name(char *hmmname, char *buf);char *rightcenter_name(char *hmmname, char *buf);/* CD_SET related */boolean regist_cdset(APATNODE **root, HTK_HMM_Data *d, char *cdname);boolean make_cdset(HTK_HMM_INFO *hmminfo);void put_all_cdinfo(HTK_HMM_INFO *hmminfo);void free_cdset(APATNODE **root);CD_Set *cdset_lookup(HTK_HMM_INFO *hmminfo, char *cdstr);CD_Set *lcdset_lookup_by_hmmname(HTK_HMM_INFO *hmminfo, char *hmmname);CD_Set *rcdset_lookup_by_hmmname(HTK_HMM_INFO *hmminfo, char *hmmname);int hmm_logical_state_num(HMM_Logical *lg);HTK_HMM_Trans *hmm_logical_trans(HMM_Logical *lg);#include <sent/htk_param.h>boolean check_param_coherence(HTK_HMM_INFO *hmm, HTK_Param *pinfo);boolean check_param_basetype(HTK_HMM_INFO *hmm, HTK_Param *pinfo);HTK_Param *new_param_check_and_adjust(HTK_HMM_INFO *hmm, HTK_Param *pinfo, boolean vflag);/* binary format */boolean write_binhmm(FILE *fp, HTK_HMM_INFO *hmm, Value *para);boolean read_binhmm(FILE *fp, HTK_HMM_INFO *hmm, boolean gzfile_p, Value *para);#endif /* __SENT_HTK_HMM_2_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -