📄 htk_hmm.h
字号:
/** * @file htk_hmm.h * @author Akinobu LEE * @date Thu Feb 10 19:36:47 2005 * * <EN> * @brief Data structures for handling HTK %HMM definition * * This file defines data structures for %HMM definition file in HTK format. * </EN> * <JA> * @brief HTK妨及の%HMMを胺うデ〖タ菇陇の年盗 * * このファイルには, HTK妨及の%HMM年盗ファイルを粕み哈むための菇陇挛が * 年盗されていますˉ * </JA> * * $Revision: 1.6 $ * *//* * Copyright (c) 1991-2006 Kawahara Lab., Kyoto University * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology * Copyright (c) 2005-2006 Julius project team, Nagoya Institute of Technology * All rights reserved */#ifndef __SENT_HTK_HMM_2_H__#define __SENT_HTK_HMM_2_H__#include <sent/stddefs.h>#include <sent/htk_defs.h>#include <sent/ptree.h>#include <sent/mfcc.h>/// Macro to check whether the next token is "A"#define currentis(A) (!strcasecmp(A, rdhmmdef_token))/// Macro to jump to error if no token left#define NoTokErr(S) if (!rdhmmdef_token) rderr(S)/// Delimiter string for parsing %HMM definition file#define HMMDEF_DELM " \t\n<>"/** * @defgroup hmminfo HTK HMM definition * <EN> * @brief Data structures for HTK %HMM definition * * The data is defined in each levels from model, state to Gaussian * components (mean and variance). Each level unit almost corresponds * to the macro * definition in the HTK definition language. Each data has links to * data of lower level, and also has a linked list to the data in the * same level. * </EN> * <JA> * @brief HTKの%HMMを呈羌するためのデ〖タ菇陇年盗 * * デ〖タ菇陇はモデルˇ觉轮からガウス尸邵の士堆ˇ尸欢まで称レベルごとに * 年盗されていますˉ称レベルはおおよそ HTK のマクロ年盗に滦炳していますˉ * 称デ〖タは, 布疤のデ〖タ菇陇へのポインタ * および票レベルの菇陇挛票晃のリンクリストを瘦积していますˉ * </JA> * *///@{/// @ingroup hmminfo/// Possible maximum value of state ID (in unsigned short)#define MAX_STATE_NUM 65535/// Delimiter strings/characters to generate logical triphone names#define HMM_RC_DLIM "+" ///< Right context delimiter in string#define HMM_LC_DLIM "-" ///< Left context delimiter in string#define HMM_RC_DLIM_C '+' ///< Right context delimiter in character#define HMM_LC_DLIM_C '-' ///< Left context delimiter in character/// Default logical name of short pause model#define SPMODEL_NAME_DEFAULT "sp"/// Length limit of HMM name (including ones generated in Julius)#define MAX_HMMNAME_LEN 128/// Specify method of calculating approximated acoustic score at inter-word context pseudo phones on word edgeenum iwcd_type { IWCD_MAX, ///< Use maximum score among context variants IWCD_AVG, ///< Use average score among context variants IWCD_NBEST ///< Use average of N-best scores among context variants};/* options info *//// Stream information (although current Julius supports only single stream)typedef struct { short num; ///< Number of stream short vsize[50]; ///< Vector size for each stream} HTK_HMM_StreamInfo;/// %HMM Optiontypedef struct { HTK_HMM_StreamInfo stream_info; ///< Stream information of this %HMM short vec_size; ///< Size of parameter vector in number of dimension short cov_type; ///< Type of covariance matrix , see also htk_defs.h short dur_type; ///< Type of duration , see also htk_defs.h short param_type; ///< Type of parameter , see also htk_defs.h} HTK_HMM_Options;/// %HMM transition tabletypedef struct _HTK_HMM_trans { char *name; ///< Name (NULL if not defined as Macro) short statenum; ///< Number of state PROB **a; ///< Matrix of transition probabilities struct _HTK_HMM_trans *next; ///< Pointer to next data, NULL if last} HTK_HMM_Trans;/// %HMM variance datatypedef struct _HTK_HMM_variance { char *name; ///< Name (NULL if not defined as Macro) VECT *vec; ///< Covariance vector (diagonal) short len; ///< Length of above struct _HTK_HMM_variance *next; ///< Pointer to next data, NULL if last} HTK_HMM_Var;/// %HMM Gaussian density (or mixture) datatypedef struct _HTK_HMM_dens { char *name; ///< Name (NULL if not defined as Macro) VECT *mean; ///< Mean vector short meanlen; ///< Length of above HTK_HMM_Var *var; ///< Link to assigned variance vector /** * Constant value in log scale for calculating Gaussiann output probability. * @sa libsent/sec/hmminfo/rdhmmdef_dens.c */ LOGPROB gconst; struct _HTK_HMM_dens *next; ///< Pointer to next data, NULL if last} HTK_HMM_Dens;/** * @brief %HMM state data * * @note * In a tied-mixture model, @a b points to a codebook defined as GCODEBOOK * intead of the array of densities. */typedef struct _HTK_HMM_state { char *name; ///< Name (NULL if not defined as Macro) short mix_num; ///< Number of densities (mixtures) assigned HTK_HMM_Dens **b; ///< Link array to assigned densities, or pointer to GCODEBOOK in tied-mixture model PROB *bweight; ///< Weights corresponding to above unsigned short id; ///< Uniq state id starting from 0 for caching of output probability struct _HTK_HMM_state *next; ///< Pointer to next data, NULL if last} HTK_HMM_State;/// Top %HMM model, corresponds to "~h" macro in hmmdefstypedef struct _HTK_HMM_data { char *name; ///< Name (NULL if not defined as Macro) short state_num; ///< Number of states in this model HTK_HMM_State **s; ///< Array of states in this model HTK_HMM_Trans *tr; ///< Link to assigned transition matrix struct _HTK_HMM_data *next; ///< Pointer to next data, NULL if last} HTK_HMM_Data;/// Gaussian mixture codebook in tied-mixture modeltypedef struct { char *name; ///< Codebook name (NULL if not defined as Macro) int num; ///< Number of mixtures in this codebook HTK_HMM_Dens **d; ///< Array of links to mixture instances unsigned short id; ///< Uniq id for caching of output probability} GCODEBOOK;//@}/// Set of %HMM states for Gaussian Mixture Selectiontypedef struct { HTK_HMM_State *state; ///< Pointer to %HMM states defined for GMS /* GCODEBOOK *book;*/ /* pointer to the corresponding codebook in hmminfo */} GS_SET;/** * @defgroup cdset Context-Dependent HMM set * <EN> * @brief Set of %HMM states with the same base phone and state location * * This structure will be used to handle cross-word triphone on the 1st pass. * At a triphone %HMM at the edge of a word in the tree lexicon, * the state nodes should have a set of %HMM states with the same base phone of * all triphones at the same location instead of a single state information. * This context-dependent %HMM set for cross-word triphone is also * called as "pseudo" phone in Julius. * * When computing the 1st pass, the maximum (or average or N-best average) * value from the likelihoods of state set will be taken as the output * probability of the states instead of the actual cross-word triphone. * * * This approximated value will be fixed by re-computation on the 2nd pass. * </EN> * <JA> * @brief 票じベ〖ス不燎の票じ疤弥にある%HMM觉轮の礁圭 * * この菇陇挛は妈1パスで帽胳粗トライフォンを胺うのに脱いられますˉ * 腾菇陇步辑今惧で·帽胳の琐眉のトライフォン%HMMにおける称觉轮は· * 奶撅の%HMMとは佰なりその姜眉不燎と票じベ〖ス不燎を积つトライフォンの * 票じ疤弥の觉轮のリストを积ちますˉこのリスト步されたコンテキスト巴赂 * %HMMの礁圭は·"pseudo" phone とも钙ばれますˉ * * 妈1パス纷换箕には·その觉轮の不读锑刨は·靠の帽胳粗トライフォンの * 夺击猛として·リスト面の称觉轮の不读锑刨の呵络猛∈あるいは士堆猛· * あるいはNbestの觉轮の士堆猛∷が脱いられるˉ * * この夺击猛は妈2パスで浩纷换されるˉ * </JA> * * @sa htk_hmm.h * @sa libsent/src/hmminfo/cdhmm.c * @sa libsent/src/hmminfo/cdset.c * @sa libsent/src/hmminfo/guess_cdHMM.c * *///@{/// @ingroup cdset/// Context-dependent state set, equivalent to HTK_HMM_State, part of pseudo phonetypedef struct { HTK_HMM_State **s; ///< Link Array to belonging states unsigned short num; ///< Number of states unsigned short maxnum; ///< Allocated number of above} CD_State_Set;/** * @brief Context-dependent %HMM set (called "pseudo") for a logical context * * Context-dependent %HMM set for a logical context * (e.g. "a-k", "e+b", "e", each corresponds to triphone list of * "a-k+*", "*-e+b", "*-e+*"). */typedef struct _cd_set{ char *name; ///< Logical name of this %HMM set ("a-k", "e+b", "e", etc.) CD_State_Set *stateset; ///< Array of state set for each state location unsigned short state_num; ///< Number of state set
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -