00001
00023
00024
00025
00026
00027
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
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
00060
00061
00062
00063
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
00088
00089
00090
00091
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("localhost:0");
00096 #endif
00097
00098
00099
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
00111 GLOBAL int smpPeriod GLOBAL_VAL(625);
00112 GLOBAL int smpFreq GLOBAL_VAL(16000);
00113 GLOBAL int fshift GLOBAL_VAL(DEF_FRAMESHIFT);
00114 GLOBAL int fsize GLOBAL_VAL(DEF_FRAMESIZE);
00115 GLOBAL int delwin GLOBAL_VAL(DEF_DELWIN);
00116 GLOBAL int accwin GLOBAL_VAL(DEF_ACCWIN);
00117
00118 GLOBAL int hipass GLOBAL_VAL(-1);
00119 GLOBAL int lopass GLOBAL_VAL(-1);
00120 GLOBAL float preemph GLOBAL_VAL(DEF_PREENPH);
00121 GLOBAL int fbank_num GLOBAL_VAL(DEF_FBANK);
00122 GLOBAL int ceplifter GLOBAL_VAL(DEF_CEPLIF);
00123 GLOBAL boolean rawe_required GLOBAL_VAL(FALSE);
00124 GLOBAL boolean enormal_required GLOBAL_VAL(FALSE);
00125 GLOBAL float enormal_escale GLOBAL_VAL(1.0);
00126 GLOBAL float enormal_silfloor GLOBAL_VAL(DEF_SILFLOOR);
00127
00128
00129
00130 GLOBAL boolean sscalc GLOBAL_VAL(FALSE);
00131 GLOBAL int sscalc_len GLOBAL_VAL(300);
00132 GLOBAL float ssalpha GLOBAL_VAL(DEF_SSALPHA);
00133 GLOBAL float ssfloor GLOBAL_VAL(DEF_SSFLOOR);
00134
00135
00136
00137 #ifdef USE_NGRAM
00138 GLOBAL LOGPROB lm_weight;
00139 GLOBAL LOGPROB lm_penalty;
00140 GLOBAL LOGPROB lm_weight2;
00141 GLOBAL LOGPROB lm_penalty2;
00142 GLOBAL LOGPROB lm_penalty_trans GLOBAL_VAL(0.0);
00143 #endif
00144 #ifdef USE_DFA
00145 GLOBAL LOGPROB penalty1 GLOBAL_VAL(0.0);
00146 GLOBAL LOGPROB penalty2 GLOBAL_VAL(0.0);
00147 #endif
00148
00149 #ifdef CONFIDENCE_MEASURE
00150
00151
00152 #ifdef CM_MULTIPLE_ALPHA
00153 GLOBAL LOGPROB cm_alpha_bgn GLOBAL_VAL(0.03);
00154 GLOBAL LOGPROB cm_alpha_end GLOBAL_VAL(0.15);
00155 GLOBAL LOGPROB cm_alpha_step GLOBAL_VAL(0.03);
00156 GLOBAL int cm_alpha_num GLOBAL_VAL(5);
00157 #else
00158 GLOBAL LOGPROB cm_alpha GLOBAL_VAL(0.05);
00159 #endif
00160 #ifdef CM_SEARCH_LIMIT
00161 GLOBAL LOGPROB cm_cut_thres GLOBAL_VAL(0.03);
00162 #endif
00163 #ifdef CM_SEARCH_LIMIT_POP
00164 GLOBAL LOGPROB cm_cut_thres_pop GLOBAL_VAL(0.1);
00165 #endif
00166 #endif
00167
00168
00169
00170 #ifdef USE_NGRAM
00171 GLOBAL char *head_silname GLOBAL_VAL(BEGIN_WORD_DEFAULT);
00172 GLOBAL char *tail_silname GLOBAL_VAL(END_WORD_DEFAULT);
00173
00174 GLOBAL boolean enable_iwspword GLOBAL_VAL(FALSE);
00175 GLOBAL char *iwspentry GLOBAL_VAL(IWSPENTRY_DEFAULT);
00176 #endif
00177 GLOBAL char *spmodel_name GLOBAL_VAL(SPMODEL_NAME_DEFAULT);
00178
00179 #ifdef MULTIPATH_VERSION
00180
00181
00182
00183 GLOBAL boolean enable_iwsp GLOBAL_VAL(FALSE);
00184 GLOBAL LOGPROB iwsp_penalty GLOBAL_VAL(IWSP_PENALTY_DEFAULT);
00185 #endif
00186
00187
00188
00189 GLOBAL int gprune_method GLOBAL_VAL(GPRUNE_SEL_UNDEF);
00190 GLOBAL int mixnum_thres GLOBAL_VAL(2);
00191 GLOBAL int gs_statenum GLOBAL_VAL(24);
00192
00193
00194
00195 GLOBAL int gmm_gprune_num GLOBAL_VAL(10);
00196 GLOBAL char *gmm_reject_cmn_string GLOBAL_VAL(NULL);
00197 GLOBAL int rejectshortlen GLOBAL_VAL(0);
00198
00199
00200
00201 GLOBAL int specified_trellis_beam_width GLOBAL_VAL(-1);
00202 GLOBAL int trellis_beam_width GLOBAL_VAL(-1);
00203 #ifdef SEPARATE_BY_UNIGRAM
00204 GLOBAL int separate_wnum GLOBAL_VAL(DEFAULT_SEPARATE_WNUM);
00205 #endif
00206 #ifdef WPAIR
00207 # ifdef WPAIR_KEEP_NLIMIT
00208 GLOBAL int wpair_keep_nlimit GLOBAL_VAL(3);
00209 # endif
00210 #endif
00211 #ifdef HASH_CACHE_IW
00212 GLOBAL int iw_cache_rate GLOBAL_VAL(10);
00213 #endif
00214
00215
00216
00217 GLOBAL int enveloped_bestfirst_width GLOBAL_VAL(30);
00218 #ifdef SCAN_BEAM
00219 GLOBAL LOGPROB scan_beam_thres GLOBAL_VAL(80.0);
00220 #endif
00221 GLOBAL int hypo_overflow GLOBAL_VAL(2000);
00222 GLOBAL int stack_size GLOBAL_VAL(500);
00223 GLOBAL int lookup_range GLOBAL_VAL(5);
00224 GLOBAL int nbest;
00225 GLOBAL int output_hypo_maxnum GLOBAL_VAL(1);
00226
00227 #ifdef GRAPHOUT
00228
00229
00230 GLOBAL int graph_merge_neighbor_range GLOBAL_VAL(0);
00231 GLOBAL int graph_totalwordnum GLOBAL_VAL(0);
00232 #endif
00233
00234 #ifdef SP_BREAK_CURRENT_FRAME
00235
00236
00237 GLOBAL int sp_frame_duration GLOBAL_VAL(10);
00238 #endif
00239
00240
00241
00242 GLOBAL int result_output GLOBAL_VAL(SP_RESULT_TTY);
00243 GLOBAL int progout_interval GLOBAL_VAL(300);
00244 #ifdef CHARACTER_CONVERSION
00245 GLOBAL char *from_code GLOBAL_VAL(NULL);
00246 GLOBAL char *to_code GLOBAL_VAL(NULL);
00247 #endif
00248
00249
00250
00251 GLOBAL int module_port GLOBAL_VAL(DEFAULT_MODULEPORT);
00252
00253
00254
00255 GLOBAL float cmn_map_weight GLOBAL_VAL(100.0);
00256
00257
00258
00259
00260
00261
00262
00263 GLOBAL boolean wchmm_check_flag GLOBAL_VAL(FALSE);
00264 GLOBAL boolean trellis_check_flag GLOBAL_VAL(FALSE);
00265 GLOBAL boolean triphone_check_flag GLOBAL_VAL(FALSE);
00266
00267
00268
00269 GLOBAL boolean forcedict_flag GLOBAL_VAL(FALSE);
00270
00271
00272
00273 GLOBAL boolean compute_only_1pass GLOBAL_VAL(FALSE);
00274 GLOBAL boolean forced_realtime GLOBAL_VAL(FALSE);
00275 GLOBAL boolean force_realtime_flag GLOBAL_VAL(FALSE);
00276 #ifdef CATEGORY_TREE
00277 GLOBAL boolean old_tree_function_flag GLOBAL_VAL(FALSE);
00278 #ifdef PASS1_IWCD
00279 GLOBAL boolean old_iwcd_flag GLOBAL_VAL(FALSE);
00280 #endif
00281 #endif
00282 #ifdef USE_NGRAM
00283 GLOBAL short iwcdmethod GLOBAL_VAL(IWCD_NBEST);
00284 #else
00285 GLOBAL short iwcdmethod GLOBAL_VAL(IWCD_AVG);
00286 #endif
00287 GLOBAL short iwcdmaxn GLOBAL_VAL(3);
00288 #ifdef USE_DFA
00289 GLOBAL boolean looktrellis_flag GLOBAL_VAL(FALSE);
00290 GLOBAL boolean multigramout_flag GLOBAL_VAL(FALSE);
00291 #endif
00292 GLOBAL boolean result_reorder_flag GLOBAL_VAL(TRUE);
00293
00294
00295
00296 GLOBAL boolean align_result_word_flag GLOBAL_VAL(FALSE);
00297 GLOBAL boolean align_result_phoneme_flag GLOBAL_VAL(FALSE);
00298 GLOBAL boolean align_result_state_flag GLOBAL_VAL(FALSE);
00299
00300
00301
00302 GLOBAL boolean module_mode GLOBAL_VAL(FALSE);
00303
00304
00305
00306 GLOBAL boolean verbose_flag GLOBAL_VAL(TRUE);
00307 GLOBAL boolean debug2_flag GLOBAL_VAL(FALSE);
00308 GLOBAL boolean paramtype_check_flag GLOBAL_VAL(TRUE);
00309 GLOBAL boolean progout_flag GLOBAL_VAL(FALSE);
00310 #ifdef USE_NGRAM
00311 GLOBAL boolean separate_score_flag GLOBAL_VAL(FALSE);
00312 #endif
00313
00314
00315
00316 GLOBAL boolean cmn_update GLOBAL_VAL(TRUE);
00317
00318
00319
00320
00321
00322 GLOBAL boolean lmp_specified GLOBAL_VAL(FALSE);
00323 GLOBAL boolean lmp2_specified GLOBAL_VAL(FALSE);
00324
00325 GLOBAL boolean realtime_flag GLOBAL_VAL(FALSE);
00326 GLOBAL boolean ccd_flag GLOBAL_VAL(TRUE);
00327 GLOBAL boolean ccd_flag_force GLOBAL_VAL(FALSE);
00328
00329
00330 GLOBAL boolean catch_intr_flag GLOBAL_VAL(FALSE);
00331
00332
00333
00334
00335
00336
00337 GLOBAL HTK_HMM_INFO *hmminfo GLOBAL_VAL(NULL);
00338 GLOBAL HTK_HMM_INFO *hmm_gs GLOBAL_VAL(NULL);
00339 GLOBAL WORD_INFO *winfo GLOBAL_VAL(NULL);
00340 #ifdef USE_NGRAM
00341 GLOBAL NGRAM_INFO *ngram GLOBAL_VAL(NULL);
00342 #else
00343 GLOBAL MULTIGRAM *gramlist GLOBAL_VAL(NULL);
00344 GLOBAL DFA_INFO *dfa GLOBAL_VAL(NULL);
00345 #endif
00346 GLOBAL HTK_HMM_INFO *gmm GLOBAL_VAL(NULL);
00347
00348
00349 GLOBAL WCHMM_INFO *wchmm GLOBAL_VAL(NULL);
00350 GLOBAL BACKTRELLIS backtrellis;
00351 GLOBAL LOGPROB backmax;
00352
00353
00354 GLOBAL int peseqlen;
00355
00356
00357 #ifdef SCAN_BEAM
00358 GLOBAL LOGPROB *framemaxscore;
00359 #endif
00360
00361
00362 GLOBAL SP16 speech[MAXSPEECHLEN];
00363 GLOBAL int speechlen GLOBAL_VAL(0);
00364 GLOBAL boolean cmn_loaded GLOBAL_VAL(FALSE);
00365 GLOBAL boolean delta_required GLOBAL_VAL(TRUE);
00366 GLOBAL boolean acc_required GLOBAL_VAL(FALSE);
00367 GLOBAL boolean energy_required GLOBAL_VAL(TRUE);
00368 GLOBAL boolean abs_energy_suppress GLOBAL_VAL(TRUE);
00369 GLOBAL boolean c0_required GLOBAL_VAL(FALSE);
00370 GLOBAL boolean cmn_required GLOBAL_VAL(TRUE);
00371 GLOBAL int model_mfcc_dim GLOBAL_VAL(12);
00372 GLOBAL boolean zmean_frame GLOBAL_VAL(FALSE);
00373
00374
00375 GLOBAL float *ssbuf GLOBAL_VAL(NULL);
00376 GLOBAL int sslen;
00377
00378 #ifdef SP_BREAK_CURRENT_FRAME
00379
00380 GLOBAL HTK_Param *rest_param GLOBAL_VAL(NULL);
00381 GLOBAL WORD_ID sp_break_last_word GLOBAL_VAL(WORD_INVALID);
00382 GLOBAL WORD_ID sp_break_last_nword GLOBAL_VAL(WORD_INVALID);
00383 GLOBAL boolean sp_break_last_nword_allow_override GLOBAL_VAL(TRUE);
00384 GLOBAL WORD_ID sp_break_2_begin_word GLOBAL_VAL(WORD_INVALID);
00385 GLOBAL WORD_ID sp_break_2_end_word GLOBAL_VAL(WORD_INVALID);
00386 #endif
00387
00388
00389 GLOBAL int module_sd GLOBAL_VAL(-1);
00390
00391
00392 GLOBAL WORD_ID pass1_wseq[MAXSEQNUM];
00393 GLOBAL int pass1_wnum;
00394 GLOBAL LOGPROB pass1_score;
00395
00396
00397 GLOBAL void (*status_process_online)();
00398 GLOBAL void (*status_process_offline)();
00399 GLOBAL void (*status_recready)();
00400 GLOBAL void (*status_recstart)();
00401 GLOBAL void (*status_recend)();
00402 GLOBAL void (*status_param)(HTK_Param *p);
00403 GLOBAL void (*result_pass1_begin)();
00404 GLOBAL void (*result_pass1_current)(int t, WORD_ID *seq, int num, LOGPROB score, LOGPROB LMscore, WORD_INFO *winfo);
00405 GLOBAL void (*result_pass1_final)(WORD_ID *seq, int num, LOGPROB score, LOGPROB LMscore, WORD_INFO *winfo);
00406 GLOBAL void (*result_pass1_end)();
00407 GLOBAL void (*result_pass2_begin)();
00408 GLOBAL void (*result_pass2)(NODE *hypo, int rank, WORD_INFO *winfo);
00409 GLOBAL void (*result_pass2_end)();
00410 GLOBAL void (*result_pass2_failed)(WORD_INFO *winfo);
00411 GLOBAL void (*result_rejected)(const char *);
00412 GLOBAL void (*result_gmm)();
00413 #ifdef GRAPHOUT
00414 GLOBAL void (*result_graph)(WordGraph *root, WORD_INFO *winfo);
00415 #endif
00416
00417 #endif