libjulius/include/julius/wchmm.h

Go to the documentation of this file.
00001 
00034 /*
00035  * Copyright (c) 1991-2007 Kawahara Lab., Kyoto University
00036  * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
00037  * Copyright (c) 2005-2007 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 
00050 typedef struct s_cell {
00051   WORD_ID word;                 
00052   struct s_cell *next;          
00053 } S_CELL;
00054 
00055 
00056 #ifdef PASS1_IWCD
00057 
00058 /* Cross-word triphone handling */
00059 
00065 typedef struct {
00066   HMM_Logical  *hmm;            
00067   short         state_loc;      
00068   /* Context cache */
00069   boolean       last_is_lset;   
00070   union {
00071     HTK_HMM_State *state;       
00072     CD_State_Set  *lset;        
00073   } cache;
00074   WORD_ID       lastwid_cache;  
00075 } RC_INFO;
00076 
00082 typedef struct {
00083   HMM_Logical  *hmm;            
00084   short         state_loc;      
00085   /* Context cache */
00086   boolean       last_is_lset;   
00087   WORD_ID       category;       
00088   union {
00089     HTK_HMM_State *state;       
00090     CD_State_Set  *lset;        
00091   } cache;
00092   WORD_ID       lastwid_cache;  
00093 } LRC_INFO;
00094 
00095 /* For word tail phoneme, pseudo phone on the dictionary will be directly
00096    used as context-dependent state set */
00097 
00103 typedef union {
00104   HTK_HMM_State *state;         
00105   CD_State_Set  *lset;          
00106   RC_INFO       *rset;          
00107   LRC_INFO      *lrset;         
00108 } ACOUSTIC_SPEC;
00109 
00114 typedef enum {
00115   AS_STATE,                     
00116   AS_LSET,                      
00117   AS_RSET,                      
00118   AS_LRSET                      
00119 } AS_Style;
00120 #endif
00121   
00122 /*************************************************************************/
00127 typedef struct {
00129   LOGPROB *probcache;
00131   WORD_ID *lastwcache;
00149   LOGPROB **iw_sc_cache;
00154   int iw_cache_num;
00155 #ifdef HASH_CACHE_IW
00156   WORD_ID *iw_lw_cache; 
00157 #endif
00158   
00159 } LM_PROB_CACHE;
00160 
00161 /*************************************************************************/
00166 #define A_CELL2_ALLOC_STEP 4
00167 
00172 typedef struct __A_CELL2__ {
00178   unsigned short n;
00179   int arc[A_CELL2_ALLOC_STEP];  
00180   LOGPROB a[A_CELL2_ALLOC_STEP]; 
00181   struct __A_CELL2__ *next;     
00182 } A_CELL2;
00183 
00188 typedef struct wchmm_state {
00189 #ifdef PASS1_IWCD
00190   ACOUSTIC_SPEC out;            
00191   /* below has been moved to WCHMM (04/06/22 by ri) */
00192   /*unsigned char       outstyle;       output type (one of AS_Style) */
00193 #else  /* ~PASS1_IWCD */
00194   HTK_HMM_State *out;           
00195 #endif /* ~PASS1_IWCD */
00196 
00202   int scid;
00203 } WCHMM_STATE;
00204 
00209 typedef struct {
00210   int *out_from;
00211   int *out_from_next;
00212   LOGPROB *out_a;
00213   LOGPROB *out_a_next;
00214   int out_from_len;
00215 } WCHMM_WORK;
00216 
00221 typedef struct wchmm_info {
00222   int lmtype;                   
00223   int lmvar;                    
00224   boolean category_tree;        
00225   HTK_HMM_INFO *hmminfo;        
00226   NGRAM_INFO *ngram;            
00227   DFA_INFO *dfa;                
00228   WORD_INFO *winfo;             
00229   boolean ccd_flag;             
00230   int   maxwcn;                 
00231   int   n;                      
00232   WCHMM_STATE   *state;         
00233   LOGPROB *self_a;              
00234   LOGPROB *next_a;              
00235   A_CELL2 **ac;                 
00236   WORD_ID       *stend;         
00237   int   **offset;               
00238   int   *wordend;               
00239   int   startnum;               
00240   int   *startnode;             
00241   int   *wordbegin;             
00242   int   maxstartnum;            
00243   WORD_ID *start2wid;           
00244 #ifdef UNIGRAM_FACTORING
00245   int   *start2isolate;         
00246   int   isolatenum;             
00247 #endif
00248   LOGPROB       *wordend_a;     
00249 #ifdef PASS1_IWCD
00250   unsigned char *outstyle;      
00251 #endif
00252   /* Successor lists on the tree are stored on sequencial list at @a sclist,
00253      and each node has index to the list */
00254   S_CELL **sclist;              
00255   int *sclist2node;             
00256   int   scnum;                  
00257 #ifdef UNIGRAM_FACTORING
00258   LOGPROB *fscore;              
00259   int fsnum;                    
00260 #endif
00261   BMALLOC_BASE *malloc_root;    
00262 #ifdef PASS1_IWCD
00263   APATNODE *lcdset_category_root; 
00264 #endif /* PASS1_IWCD */
00265 
00266   HMMWork *hmmwrk;              
00267 
00268   LM_PROB_CACHE lmcache;        
00269 
00270   WCHMM_WORK wrk;               
00271 
00272   int separated_word_count; 
00273 
00274   /* user-defined functions, used when this->lmvar == LM_NGRAM_USER */
00275   /* they are local copy from parent Recog instance */
00276   LOGPROB (*uni_prob_user)(WORD_INFO *, WORD_ID, LOGPROB); 
00277 
00278   LOGPROB (*bi_prob_user)(WORD_INFO *, WORD_ID, WORD_ID, LOGPROB); 
00279 
00280 } WCHMM_INFO;
00281 
00282 #endif /* __J_WORD_CONJ_HMM_H__ */

Generated on Tue Dec 18 15:59:50 2007 for Julius by  doxygen 1.5.4