Julius 4.2
libjulius/include/julius/wchmm.h
説明を見る。
00001 
00034 /*
00035  * Copyright (c) 1991-2011 Kawahara Lab., Kyoto University
00036  * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
00037  * Copyright (c) 2005-2011 Julius project team, Nagoya Institute of Technology
00038  * All rights reserved
00039  */
00040 
00041 #ifndef __J_WORD_CONJ_HMM_H__
00042 #define __J_WORD_CONJ_HMM_H__
00043 
00044 //#define               MAXWCNSTEP  40000 ///< Number of states to be allocated at once
00045 
00046 #ifdef PASS1_IWCD
00047 
00048 /* Cross-word triphone handling */
00049 
00055 typedef struct {
00056   HMM_Logical  *hmm;            
00057   short         state_loc;      
00058   /* Context cache */
00059   boolean       last_is_lset;   
00060   union {
00061     HTK_HMM_State *state;       
00062     CD_State_Set  *lset;        
00063   } cache;
00064   WORD_ID       lastwid_cache;  
00065 } RC_INFO;
00066 
00072 typedef struct {
00073   HMM_Logical  *hmm;            
00074   short         state_loc;      
00075   /* Context cache */
00076   boolean       last_is_lset;   
00077   WORD_ID       category;       
00078   union {
00079     HTK_HMM_State *state;       
00080     CD_State_Set  *lset;        
00081   } cache;
00082   WORD_ID       lastwid_cache;  
00083 } LRC_INFO;
00084 
00085 /* For word tail phoneme, pseudo phone on the dictionary will be directly
00086    used as context-dependent state set */
00087 
00093 typedef union {
00094   HTK_HMM_State *state;         
00095   CD_State_Set  *lset;          
00096   RC_INFO       *rset;          
00097   LRC_INFO      *lrset;         
00098 } ACOUSTIC_SPEC;
00099 
00104 typedef enum {
00105   AS_STATE,                     
00106   AS_LSET,                      
00107   AS_RSET,                      
00108   AS_LRSET                      
00109 } AS_Style;
00110 #endif
00111   
00112 /*************************************************************************/
00117 typedef struct {
00119   LOGPROB *probcache;
00121   WORD_ID *lastwcache;
00139   LOGPROB **iw_sc_cache;
00144   int iw_cache_num;
00145 #ifdef HASH_CACHE_IW
00146   WORD_ID *iw_lw_cache; 
00147 #endif
00148   
00149 } LM_PROB_CACHE;
00150 
00151 /*************************************************************************/
00156 #define A_CELL2_ALLOC_STEP 4
00157 
00162 typedef struct __A_CELL2__ {
00168   unsigned short n;
00169   int arc[A_CELL2_ALLOC_STEP];  
00170   LOGPROB a[A_CELL2_ALLOC_STEP]; 
00171   struct __A_CELL2__ *next;     
00172 } A_CELL2;
00173 
00178 typedef struct wchmm_state {
00179 #ifdef PASS1_IWCD
00180   ACOUSTIC_SPEC out;            
00181   /* below has been moved to WCHMM (04/06/22 by ri) */
00182   /*unsigned char       outstyle;       output type (one of AS_Style) */
00183 #else  /* ~PASS1_IWCD */
00184   HTK_HMM_State *out;           
00185 #endif /* ~PASS1_IWCD */
00186 
00192   int scid;
00193 } WCHMM_STATE;
00194 
00199 typedef struct {
00200   int *out_from;
00201   int *out_from_next;
00202   LOGPROB *out_a;
00203   LOGPROB *out_a_next;
00204   int out_from_len;
00205 } WCHMM_WORK;
00206 
00211 typedef struct wchmm_info {
00212   int lmtype;                   
00213   int lmvar;                    
00214   boolean category_tree;        
00215   HTK_HMM_INFO *hmminfo;        
00216   NGRAM_INFO *ngram;            
00217   DFA_INFO *dfa;                
00218   WORD_INFO *winfo;             
00219   boolean ccd_flag;             
00220   int   maxwcn;                 
00221   int   n;                      
00222   WCHMM_STATE   *state;         
00223   LOGPROB *self_a;              
00224   LOGPROB *next_a;              
00225   A_CELL2 **ac;                 
00226   WORD_ID       *stend;         
00227   int   **offset;               
00228   int   *wordend;               
00229   int   startnum;               
00230   int   *startnode;             
00231   int   *wordbegin;             
00232   int   maxstartnum;            
00233   WORD_ID *start2wid;           
00234 #ifdef UNIGRAM_FACTORING
00235   int   *start2isolate;         
00236   int   isolatenum;             
00237 #endif
00238   LOGPROB       *wordend_a;     
00239 #ifdef PASS1_IWCD
00240   unsigned char *outstyle;      
00241 #endif
00242   /* Successor lists on the tree are stored on sequencial list at @a sclist,
00243      and each node has index to the list */
00244   /* sclist and sclen are used at 2-gram factoring only */
00245   /* scword is used at 1-gram factoring only */
00246 #ifdef UNIGRAM_FACTORING
00247   WORD_ID *scword;              
00248   LOGPROB *fscore;              
00249   int fsnum;                    
00250 #endif
00251   WORD_ID **sclist;             
00252   WORD_ID *sclen;               
00253   int   scnum;                  
00254   BMALLOC_BASE *malloc_root;    
00255 #ifdef PASS1_IWCD
00256   APATNODE *lcdset_category_root; 
00257   BMALLOC_BASE *lcdset_mroot;
00258 #endif /* PASS1_IWCD */
00259 
00260   HMMWork *hmmwrk;              
00261 
00262   LM_PROB_CACHE lmcache;        
00263 
00264   WCHMM_WORK wrk;               
00265 
00266   int separated_word_count; 
00267 
00268   char lccbuf[MAX_HMMNAME_LEN+7]; 
00269   char lccbuf2[MAX_HMMNAME_LEN+7]; 
00270 
00271   /* user-defined functions, used when this->lmvar == LM_NGRAM_USER */
00272   /* they are local copy from parent Recog instance */
00273   LOGPROB (*uni_prob_user)(WORD_INFO *, WORD_ID, LOGPROB); 
00274 
00275   LOGPROB (*bi_prob_user)(WORD_INFO *, WORD_ID, WORD_ID, LOGPROB); 
00276 
00277 } WCHMM_INFO;
00278 
00279 #endif /* __J_WORD_CONJ_HMM_H__ */