📄 tp_param_0.cc
字号:
// file: tp_param_0.cc//// isip include files//#include "trace_projector.h"#include "trace_projector_constants.h"// method: read_params_cc//// arguments:// FILE* fp : (input) file pointer to params file//// return: a logical flag to indicate success//logical_1 Trace_projector::read_params_cc(FILE*& fp_a) { // string to hold temporary data // char_1* tmp = new char_1[ISIP_MAX_STRING_LENGTH]; char_1* tag_str = new char_1[ISIP_MAX_STRING_LENGTH]; char_1* tmp1 = new char_1[ISIP_MAX_STRING_LENGTH]; char_1* tmp2 = new char_1[ISIP_MAX_STRING_LENGTH]; char_1* tmp3 = new char_1[ISIP_MAX_STRING_LENGTH]; char_1* tmp4 = new char_1[ISIP_MAX_STRING_LENGTH]; char_1* tmp5 = new char_1[ISIP_MAX_STRING_LENGTH]; // read data from file // while (fgets((char*)tmp, ISIP_MAX_STRING_LENGTH - 1, fp_a) != (char*)NULL) { // ignore comment lines // if (tmp[0] == (char_1)'#') { // do nothing // continue; } // if the line is not empty, get the first string which should be the // tag string // if (strlen((char*)tmp) != 1) { sscanf((char*)tmp, "%s", tag_str); // read name of monophones file // if (strcmp((char*)tag_str, TP_OP_MONOPHONE_FILE) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { monophones_file_d = new char_1[strlen((char*)tmp3) + 1]; strcpy((char*)monophones_file_d, (char*)tmp3); Decoder::expand_filename_cc(monophones_file_d); } } // read name of transitions data file // else if (strcmp((char*)tag_str, TP_OP_TRANSITION_FILE) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { transitions_file_d = new char_1[strlen((char*)tmp3) + 1]; strcpy((char*)transitions_file_d, (char*)tmp3); Decoder::expand_filename_cc(transitions_file_d); } } // read name of states data file // else if (strcmp((char*)tag_str, TP_OP_STATE_FILE) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { states_file_d = new char_1[strlen((char*)tmp3) + 1]; strcpy((char*)states_file_d, (char*)tmp3); Decoder::expand_filename_cc(states_file_d); } } // read name of HMM models data file // else if (strcmp((char*)tag_str, TP_OP_MODEL_FILE) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { models_file_d = new char_1[strlen((char*)tmp3) + 1]; strcpy((char*)models_file_d, (char*)tmp3); Decoder::expand_filename_cc(models_file_d); } } // read name of triphones data file // else if (strcmp((char*)tag_str, TP_OP_PHONE_FILE) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { phones_file_d = new char_1[strlen((char*)tmp3) + 1]; strcpy((char*)phones_file_d, (char*)tmp3); Decoder::expand_filename_cc(phones_file_d); } } // read name of lexicon data file // else if (strcmp((char*)tag_str, TP_OP_LEXICON_FILE) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { lexicon_file_d = new char_1[strlen((char*)tmp3) + 1]; strcpy((char*)lexicon_file_d, (char*)tmp3); Decoder::expand_filename_cc(lexicon_file_d); } } // read name of language model data file // else if (strcmp((char*)tag_str, TP_OP_LM_FILE) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { lm_file_d = new char_1[strlen((char*)tmp3) + 1]; strcpy((char*)lm_file_d, (char*)tmp3); Decoder::expand_filename_cc(lm_file_d); } } // read name of file containing the list of grammars to be used // in a hierarchical grammar case // else if (strcmp((char*)tag_str, TP_OP_GRAM_FILE) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { gram_list_file_d = new char_1[strlen((char*)tmp3) + 1]; strcpy((char*)gram_list_file_d, (char*)tmp3); Decoder::expand_filename_cc(gram_list_file_d); } } // read the name of the forced alignment transcription file // else if (strcmp((char*)tag_str, TP_OP_TRANSCRIPTION_FILE) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { forcealign_file_d = new char_1[strlen((char*)tmp3) + 1]; strcpy((char*)forcealign_file_d, (char*)tmp3); Decoder::expand_filename_cc(forcealign_file_d); } } // read the name of the input file list // else if (strcmp((char*)tag_str, TP_OP_MFCC_LIST) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { input_file_d = new char_1[strlen((char*)tmp3) + 1]; strcpy((char*)input_file_d, (char*)tmp3); Decoder::expand_filename_cc(input_file_d); } } // read the name of the output file list // else if (strcmp((char*)tag_str, TP_OP_OUTPUT_LIST) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { output_file_d = new char_1[strlen((char*)tmp3) + 1]; strcpy((char*)output_file_d, (char*)tmp3); Decoder::expand_filename_cc(output_file_d); } } // read the name of the input lattice file list // else if (strcmp((char*)tag_str, TP_OP_LATTICE_LIST) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { lattice_file_d = new char_1[strlen((char*)tmp3) + 1]; strcpy((char*)lattice_file_d, (char*)tmp3); Decoder::expand_filename_cc(lattice_file_d); } } // read the name of the output lattice file list // else if (strcmp((char*)tag_str, TP_OP_OUTLAT_LIST) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { outlat_file_d = new char_1[strlen((char*)tmp3) + 1]; strcpy((char*)outlat_file_d, (char*)tmp3); Decoder::expand_filename_cc(outlat_file_d); } } // read the name of the output nbest file list // else if (strcmp((char*)tag_str, TP_OP_OUTNBEST_LIST) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { outnbest_file_d = new char_1[strlen((char*)tmp3) + 1]; strcpy((char*)outnbest_file_d, (char*)tmp3); Decoder::expand_filename_cc(outnbest_file_d); } } // read the name of the output lattice wer file // else if (strcmp((char*)tag_str, TP_OP_LATWER_FILE) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { latwer_file_d = new char_1[strlen((char*)tmp3) + 1]; strcpy((char*)latwer_file_d, (char*)tmp3); Decoder::expand_filename_cc(latwer_file_d); } } // read the value for ngram size // else if (strcmp((char*)tag_str, TP_OP_NGRAM) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { ngram_size_d = (int_4)atoi((char*)tmp3); } } // read the value for number of history paths // else if (strcmp((char*)tag_str, TP_OP_HISTORY) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { num_hist_d = (int_4)atoi((char*)tmp3); } } // read the value for number of nbest paths to output // else if (strcmp((char*)tag_str, TP_OP_NBEST) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { num_nbest_d = (int_4)atoi((char*)tmp3); } } // set the beam widths if beam pruning is allowed // else if (strcmp((char*)tag_str, TP_OP_PRUNING) == 0) { if (sscanf((char*)tmp, "%s%s%s%s%s", tmp1, tmp2, tmp3, tmp4, tmp5) == 5) { beam_width_d[0] = -(float_4)fabs((float_4)atof((char*)tmp3)); beam_width_d[1] = -(float_4)fabs((float_4)atof((char*)tmp4)); beam_width_d[2] = -(float_4)fabs((float_4)atof((char*)tmp5)); } } // set the limit on maximum active phone model instances if // specified // else if (strcmp((char*)tag_str, TP_OP_MAPMI) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { mapmi_limit_d = (int_4)atoi((char*)tmp3); if (mapmi_limit_d < (int_4)0) { mapmi_limit_d = (int_4)0; } } } // set the limit on maximum number of words allowed to grow in // each frame if specified // else if (strcmp((char*)tag_str, TP_OP_NUMWORDS) == 0) { if (sscanf((char*)tmp, "%s%s%s", tmp1, tmp2, tmp3) == 3) { num_wdcut_d = (int_4)atoi((char*)tmp3);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -