julius/global.h

説明を見る。
00001 
00023 /*
00024  * Copyright (c) 1991-2006 Kawahara Lab., Kyoto University
00025  * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
00026  * Copyright (c) 2005-2006 Julius project team, Nagoya Institute of Technology
00027  * All rights reserved
00028  */
00029 
00030 #ifndef __SENT_EXTERNAL_DEFINITION__
00031 #define __SENT_EXTERNAL_DEFINITION__
00032 
00033 #include <sent/stddefs.h>
00034 #include <sent/hmm.h>
00035 #include <sent/vocabulary.h>
00036 #ifdef USE_NGRAM
00037 #include <sent/ngram2.h>
00038 #else  /* USE_DFA */
00039 #include <sent/dfa.h>
00040 #endif
00041 #include "wchmm.h"
00042 #include "search.h"
00043 
00049 #ifdef GLOBAL_VARIABLE_DEFINE
00050 #define GLOBAL /*  */
00051 #define GLOBAL_VAL(v) = (v)
00052 #else
00053 #define GLOBAL extern
00054 #define GLOBAL_VAL(v) /*  */
00055 #endif
00056 
00057 
00058 /* -------------------------------------------------------------- */
00059 /* ------- User-specified filenames ----------------------------- */
00060 /* -------------------------------------------------------------- */
00061 
00062 /********************************************/
00063 /* File names (NULL if not specified) */
00064 GLOBAL char *hmmfilename GLOBAL_VAL(NULL);
00065 GLOBAL char *mapfilename GLOBAL_VAL(NULL); 
00066 GLOBAL char *hmm_gs_filename GLOBAL_VAL(NULL); 
00067 GLOBAL char *dictfilename GLOBAL_VAL(NULL); 
00068 #ifdef USE_NGRAM
00069 GLOBAL char *ngram_filename GLOBAL_VAL(NULL); 
00070 GLOBAL char *ngram_filename_lr_arpa GLOBAL_VAL(NULL); 
00071 GLOBAL char *ngram_filename_rl_arpa GLOBAL_VAL(NULL); 
00072 #endif
00073 #ifdef USE_DFA
00074 GLOBAL char *dfa_filename GLOBAL_VAL(NULL); 
00075 GLOBAL GRAMLIST *gramlist_root GLOBAL_VAL(NULL); 
00076 #endif
00077 
00078 GLOBAL char *inputlist_filename GLOBAL_VAL(NULL); 
00079 GLOBAL char *cmnload_filename GLOBAL_VAL(NULL); 
00080 GLOBAL char *cmnsave_filename GLOBAL_VAL(NULL); 
00081 GLOBAL char *ssload_filename GLOBAL_VAL(NULL); 
00082 GLOBAL char *record_dirname GLOBAL_VAL(NULL); 
00083 GLOBAL char *gmm_filename GLOBAL_VAL(NULL); 
00084 
00085 
00086 /* -------------------------------------------------------------- */
00087 /* ------- User-specified parameters --------- ------------------ */
00088 /* -------------------------------------------------------------- */
00089 
00090 /********************************************/
00091 /* Input source */
00092 GLOBAL int speech_input GLOBAL_VAL(SP_MFCFILE); 
00093 GLOBAL int adinnet_port GLOBAL_VAL(ADINNET_PORT); 
00094 #ifdef USE_NETAUDIO
00095 GLOBAL char *netaudio_devname GLOBAL_VAL(NULL); 
00096 #endif
00097 
00098 /********************************************/
00099 /* Input triggering and silence cutting */
00100 GLOBAL int silence_cut GLOBAL_VAL(2); 
00101 GLOBAL int level_thres GLOBAL_VAL(2000); 
00102 GLOBAL int zero_cross_num GLOBAL_VAL(60); 
00103 GLOBAL int head_margin_msec GLOBAL_VAL(300); 
00104 GLOBAL int tail_margin_msec GLOBAL_VAL(400); 
00105 
00106 GLOBAL boolean strip_zero_sample GLOBAL_VAL(TRUE); 
00107 GLOBAL boolean use_zmean GLOBAL_VAL(FALSE); 
00108 
00109 /********************************************/
00110 /* Speech analysis parameters */
00111 GLOBAL Value para;              
00112 GLOBAL Value para_hmm;          
00113 GLOBAL Value para_htk;  
00114 GLOBAL Value para_default;    
00115 GLOBAL Value para_dummy;    
00116 
00117 /********************************************/
00118 /* Spectral subtraction */
00119 GLOBAL boolean sscalc GLOBAL_VAL(FALSE); 
00120 GLOBAL int sscalc_len GLOBAL_VAL(300); 
00121 /* ssfloor, ssalpha moved into Value */
00122 
00123 /********************************************/
00124 /* LM parameters (default will be set in m_bootup.c) */
00125 #ifdef USE_NGRAM
00126 GLOBAL LOGPROB lm_weight;       
00127 GLOBAL LOGPROB lm_penalty;      
00128 GLOBAL LOGPROB lm_weight2;      
00129 GLOBAL LOGPROB lm_penalty2;     
00130 GLOBAL LOGPROB lm_penalty_trans GLOBAL_VAL(0.0); 
00131 #endif /* USE_NGRAM */
00132 #ifdef USE_DFA
00133 GLOBAL LOGPROB penalty1 GLOBAL_VAL(0.0); 
00134 GLOBAL LOGPROB penalty2 GLOBAL_VAL(0.0); 
00135 #endif
00136 
00137 #ifdef CONFIDENCE_MEASURE
00138 /********************************************/
00139 /* Confidence measure */
00140 #ifdef CM_MULTIPLE_ALPHA        /* Test multiple alpha coef. for confidence scoring */
00141 GLOBAL LOGPROB cm_alpha_bgn GLOBAL_VAL(0.03); 
00142 GLOBAL LOGPROB cm_alpha_end GLOBAL_VAL(0.15); 
00143 GLOBAL LOGPROB cm_alpha_step GLOBAL_VAL(0.03); 
00144 GLOBAL int cm_alpha_num GLOBAL_VAL(5); 
00145 #else  /* single value (default) */
00146 GLOBAL LOGPROB cm_alpha GLOBAL_VAL(0.05); 
00147 #endif
00148 #ifdef CM_SEARCH_LIMIT
00149 GLOBAL LOGPROB cm_cut_thres GLOBAL_VAL(0.03); 
00150 #endif
00151 #ifdef CM_SEARCH_LIMIT_POP
00152 GLOBAL LOGPROB cm_cut_thres_pop GLOBAL_VAL(0.1); 
00153 #endif
00154 #endif /* CONFIDENCE_MEASURE */
00155 
00156 /********************************************/
00157 /* Pause (silence) model related */
00158 #ifdef USE_NGRAM
00159 GLOBAL char *head_silname GLOBAL_VAL(NULL); 
00160 GLOBAL char *tail_silname GLOBAL_VAL(NULL); 
00161 /* Short pause word, that will be added to dictionary when "-iwspword" is spcified */
00162 GLOBAL boolean enable_iwspword GLOBAL_VAL(FALSE); 
00163 GLOBAL char *iwspentry GLOBAL_VAL(NULL); 
00164 #endif
00165 GLOBAL char *spmodel_name GLOBAL_VAL(NULL); 
00166 
00167 #ifdef MULTIPATH_VERSION
00168 /* 1) in DFA mode, a word with only "spmodel_name" model as a pronunciation will be specially handled as "short-pause word" */
00169 /* 2) if "-iwsp" enabled, the "spmodel_name" model will be attached to every word end within the dictionary */
00170 /* short pause special handling */
00171 GLOBAL boolean enable_iwsp GLOBAL_VAL(FALSE); /* enable inter-word short pause handling */
00172 GLOBAL LOGPROB iwsp_penalty GLOBAL_VAL(IWSP_PENALTY_DEFAULT); /* transition penalty of inter-word short pause */
00173 #endif
00174 
00175 /**********************************************/
00176 /* Search parameters for acoustic computation */
00177 GLOBAL int gprune_method GLOBAL_VAL(GPRUNE_SEL_UNDEF); 
00178 GLOBAL int mixnum_thres GLOBAL_VAL(2);  
00179 GLOBAL int gs_statenum GLOBAL_VAL(24);  
00180 
00181 /********************************************/
00182 /* Input rejection by GMM and input length */
00183 GLOBAL int gmm_gprune_num GLOBAL_VAL(10); 
00184 GLOBAL char *gmm_reject_cmn_string GLOBAL_VAL(NULL); 
00185 GLOBAL int rejectshortlen GLOBAL_VAL(0); 
00186 
00187 /********************************************/
00188 /* Search parameters for 1st pass */
00189 GLOBAL int specified_trellis_beam_width GLOBAL_VAL(-1); 
00190 GLOBAL int trellis_beam_width GLOBAL_VAL(-1); 
00191 #ifdef SEPARATE_BY_UNIGRAM
00192 GLOBAL int separate_wnum GLOBAL_VAL(DEFAULT_SEPARATE_WNUM); 
00193 #endif
00194 #ifdef WPAIR
00195 # ifdef WPAIR_KEEP_NLIMIT
00196 GLOBAL int wpair_keep_nlimit GLOBAL_VAL(3); 
00197 # endif
00198 #endif
00199 #ifdef HASH_CACHE_IW
00200 GLOBAL int iw_cache_rate GLOBAL_VAL(10); 
00201 #endif
00202 
00203 /********************************************/
00204 /* Search parameters for 2nd pass */
00205 GLOBAL int enveloped_bestfirst_width GLOBAL_VAL(30); 
00206 #ifdef SCAN_BEAM
00207 GLOBAL LOGPROB scan_beam_thres GLOBAL_VAL(80.0); 
00208 #endif
00209 GLOBAL int hypo_overflow GLOBAL_VAL(2000); 
00210 GLOBAL int stack_size GLOBAL_VAL(500); 
00211 GLOBAL int lookup_range GLOBAL_VAL(5); 
00212 GLOBAL int nbest;               
00213 GLOBAL int output_hypo_maxnum GLOBAL_VAL(1); 
00214 
00215 #ifdef GRAPHOUT
00216 /********************************************/
00217 /* Word graph output */
00218 GLOBAL int graph_merge_neighbor_range GLOBAL_VAL(0); 
00219 GLOBAL int graph_totalwordnum GLOBAL_VAL(0); 
00220 #ifdef GRAPHOUT_DEPTHCUT
00221 GLOBAL int graphout_cut_depth GLOBAL_VAL(GRAPHOUT_DEPTHCUT_DEFAULT); 
00222 #endif
00223 #ifdef GRAPHOUT_LIMIT_BOUNDARY_LOOP
00224 GLOBAL int graphout_limit_boundary_loop_num GLOBAL_VAL(GRAPHOUT_LIMIT_BOUNDARY_LOOP_NUM_DEFAULT); 
00225 #endif
00226 #ifdef GRAPHOUT_SEARCH_DELAY_TERMINATION
00227 GLOBAL boolean graphout_search_delay GLOBAL_VAL(FALSE); 
00228 #endif
00229 #endif /* GRAPHOUT */
00230 
00231 #ifdef SP_BREAK_CURRENT_FRAME
00232 /********************************************/
00233 /* Short-pause segmentation */
00234 GLOBAL int sp_frame_duration GLOBAL_VAL(10);
00235 #endif /* SP_BREAK_CURRENT_FRAME */
00236 
00237 /********************************************/
00238 /* Output parameters */
00239 GLOBAL int result_output GLOBAL_VAL(SP_RESULT_TTY);
00240 GLOBAL int progout_interval GLOBAL_VAL(300); 
00241 #ifdef CHARACTER_CONVERSION
00242 GLOBAL char *from_code GLOBAL_VAL(NULL); 
00243 GLOBAL char *to_code GLOBAL_VAL(NULL); 
00244 #endif
00245 
00246 /********************************************/
00247 /* Module mode */
00248 GLOBAL int module_port GLOBAL_VAL(DEFAULT_MODULEPORT); 
00249 
00250 /********************************************/
00251 /* MAP-CMN */
00252 GLOBAL float cmn_map_weight GLOBAL_VAL(100.0); 
00253 
00254 /* -------------------------------------------------------------- */
00255 /* -------- User-specified switches ----------------------------- */
00256 /* -------------------------------------------------------------- */
00257 
00258 /********************************************/
00259 /* Enable/disable extra check mode for debugging */
00260 GLOBAL boolean wchmm_check_flag GLOBAL_VAL(FALSE); 
00261 GLOBAL boolean trellis_check_flag GLOBAL_VAL(FALSE); 
00262 GLOBAL boolean triphone_check_flag GLOBAL_VAL(FALSE); 
00263 
00264 /********************************************/
00265 /* Dictionary */
00266 GLOBAL boolean forcedict_flag GLOBAL_VAL(FALSE); 
00267 
00268 /********************************************/
00269 /* Search */
00270 GLOBAL boolean compute_only_1pass GLOBAL_VAL(FALSE); 
00271 GLOBAL boolean forced_realtime GLOBAL_VAL(FALSE); 
00272 GLOBAL boolean force_realtime_flag GLOBAL_VAL(FALSE); 
00273 #ifdef CATEGORY_TREE
00274 GLOBAL boolean old_tree_function_flag GLOBAL_VAL(FALSE); 
00275 #ifdef PASS1_IWCD
00276 GLOBAL boolean old_iwcd_flag GLOBAL_VAL(FALSE); 
00277 #endif
00278 #endif
00279 #ifdef USE_NGRAM
00280 GLOBAL short iwcdmethod GLOBAL_VAL(IWCD_NBEST); 
00281 #else
00282 GLOBAL short iwcdmethod GLOBAL_VAL(IWCD_AVG); 
00283 #endif
00284 GLOBAL short iwcdmaxn GLOBAL_VAL(3); 
00285 #ifdef USE_DFA
00286 GLOBAL boolean looktrellis_flag GLOBAL_VAL(FALSE); 
00287 GLOBAL boolean multigramout_flag GLOBAL_VAL(FALSE); 
00288 #endif
00289 GLOBAL boolean result_reorder_flag GLOBAL_VAL(TRUE); 
00290 
00291 /********************************************/
00292 /* Forced alignment */
00293 GLOBAL boolean align_result_word_flag GLOBAL_VAL(FALSE); 
00294 GLOBAL boolean align_result_phoneme_flag GLOBAL_VAL(FALSE); 
00295 GLOBAL boolean align_result_state_flag GLOBAL_VAL(FALSE); 
00296 
00297 /********************************************/
00298 /* Module mode */
00299 GLOBAL boolean module_mode GLOBAL_VAL(FALSE);
00300 
00301 /********************************************/
00302 /* Output switches */
00303 GLOBAL boolean verbose_flag GLOBAL_VAL(TRUE); 
00304 GLOBAL boolean debug2_flag GLOBAL_VAL(FALSE); 
00305 GLOBAL boolean paramtype_check_flag GLOBAL_VAL(TRUE); 
00306 GLOBAL boolean progout_flag GLOBAL_VAL(FALSE); 
00307 #ifdef USE_NGRAM
00308 GLOBAL boolean separate_score_flag GLOBAL_VAL(FALSE); 
00309 #endif
00310 
00311 /********************************************/
00312 /* CMN switches */
00313 GLOBAL boolean cmn_update GLOBAL_VAL(TRUE); 
00314 
00315 /* -------------------------------------------------------------- */
00316 /* -------- Inner status holders -------------------------------- */
00317 /* -------------------------------------------------------------- */
00318 /* for LM */
00319 GLOBAL boolean lmp_specified GLOBAL_VAL(FALSE); 
00320 GLOBAL boolean lmp2_specified GLOBAL_VAL(FALSE); 
00321 /* for search */
00322 GLOBAL boolean realtime_flag GLOBAL_VAL(FALSE); 
00323 GLOBAL boolean ccd_flag GLOBAL_VAL(TRUE); 
00324 GLOBAL boolean ccd_flag_force GLOBAL_VAL(FALSE); 
00325 
00326 /* -------------------------------------------------------------- */
00327 /* -------- Work area for search -------------------------------- */
00328 /* -------------------------------------------------------------- */
00329 
00330 /* Models */
00331 GLOBAL HTK_HMM_INFO *hmminfo GLOBAL_VAL(NULL);
00332 GLOBAL HTK_HMM_INFO *hmm_gs GLOBAL_VAL(NULL); 
00333 GLOBAL WORD_INFO *winfo GLOBAL_VAL(NULL); 
00334 #ifdef USE_NGRAM
00335 GLOBAL NGRAM_INFO *ngram GLOBAL_VAL(NULL); 
00336 #else
00337 GLOBAL MULTIGRAM *gramlist GLOBAL_VAL(NULL); 
00338 GLOBAL DFA_INFO *dfa GLOBAL_VAL(NULL); 
00339 #endif
00340 GLOBAL HTK_HMM_INFO *gmm GLOBAL_VAL(NULL); 
00341 
00342 /* Tree lexicon HMM */
00343 GLOBAL WCHMM_INFO *wchmm GLOBAL_VAL(NULL);
00344 GLOBAL BACKTRELLIS backtrellis; 
00345 GLOBAL LOGPROB backmax;         
00346 
00347 /* Misc. for search */
00348 GLOBAL int peseqlen;            
00349 
00350 /* Score envelope beaming */
00351 #ifdef SCAN_BEAM
00352 GLOBAL LOGPROB *framemaxscore;
00353 #endif
00354 
00355 /* Input speech related */
00356 GLOBAL SP16 speech[MAXSPEECHLEN]; 
00357 GLOBAL int speechlen GLOBAL_VAL(0);             
00358 GLOBAL boolean cmn_loaded GLOBAL_VAL(FALSE); 
00359 
00360 /* Spectral subtraction */
00361 GLOBAL float *ssbuf GLOBAL_VAL(NULL);
00362 GLOBAL int sslen;               
00363 
00364 #ifdef SP_BREAK_CURRENT_FRAME
00365 /* Short-pause segmentation */
00366 GLOBAL HTK_Param *rest_param GLOBAL_VAL(NULL);
00367 GLOBAL WORD_ID sp_break_last_word GLOBAL_VAL(WORD_INVALID); 
00368 GLOBAL WORD_ID sp_break_last_nword GLOBAL_VAL(WORD_INVALID); 
00369 GLOBAL boolean sp_break_last_nword_allow_override GLOBAL_VAL(TRUE); 
00370 GLOBAL WORD_ID sp_break_2_begin_word GLOBAL_VAL(WORD_INVALID); 
00371 GLOBAL WORD_ID sp_break_2_end_word GLOBAL_VAL(WORD_INVALID); 
00372 #endif
00373 
00374 /* Module */
00375 GLOBAL int module_sd GLOBAL_VAL(-1);    
00376 
00377 /* Output */
00378 GLOBAL WORD_ID pass1_wseq[MAXSEQNUM]; 
00379 GLOBAL int pass1_wnum; 
00380 GLOBAL LOGPROB pass1_score;     
00381 
00382 /* Pointer to text output functions (will be set by 'result_output') */
00383 GLOBAL void (*status_process_online)();
00384 GLOBAL void (*status_process_offline)();
00385 GLOBAL void (*status_recready)();
00386 GLOBAL void (*status_recstart)();
00387 GLOBAL void (*status_recend)();
00388 GLOBAL void (*status_param)(HTK_Param *p);
00389 GLOBAL void (*result_pass1_begin)();
00390 GLOBAL void (*result_pass1_current)(int t, WORD_ID *seq, int num, LOGPROB score, LOGPROB LMscore, WORD_INFO *winfo);
00391 GLOBAL void (*result_pass1_final)(WORD_ID *seq, int num, LOGPROB score, LOGPROB LMscore, WORD_INFO *winfo);
00392 GLOBAL void (*result_pass1_end)();
00393 GLOBAL void (*result_pass2_begin)();
00394 GLOBAL void (*result_pass2)(NODE *hypo, int rank, WORD_INFO *winfo);
00395 GLOBAL void (*result_pass2_end)();
00396 GLOBAL void (*result_pass2_failed)(WORD_INFO *winfo);
00397 GLOBAL void (*result_rejected)(const char *);
00398 GLOBAL void (*result_gmm)();
00399 #ifdef GRAPHOUT
00400 GLOBAL void (*result_graph)(WordGraph *root, WORD_INFO *winfo);
00401 #endif
00402 
00403 #endif /* __SENT_EXTERNAL_DEFINITION__ */

Juliusに対してTue Dec 26 16:19:27 2006に生成されました。  doxygen 1.5.0