📄 ts_phones_1.cc
字号:
// file: ts_phone_1.cc//// system include files//#include <memory.h>// isip include files//#include "tie_state.h"#include "tie_state_constants.h"// method: read_spm_cc//// arguments:// int_4& num_spm : (output) number of special models// FILE* fp_sph : (input) data file pointer// // return: a char_1** list of special models//char_1** read_spm_cc(int_4& num_spm_a, FILE* fp_spm_a) { // variables to read data // char_1* tmp = new char_1[ISIP_MAX_STRING_LENGTH]; char_1** temp_models = new char_1*[TS_MAX_NUM_SPEMODEL]; char_1** special_models = (char_1**)NULL; num_spm_a = 0; // read data from file // while (fscanf(fp_spm_a, "%s", tmp) != EOF) { // ignore comment lines // if (tmp[0] == (char_1)'#') { // do nothing // fscanf(fp_spm_a, "%[^\n]", tmp); fscanf(fp_spm_a, "%[\n]", tmp); } // read the monophone data // else { // allocate memory for special model // temp_models[num_spm_a] = new char_1[TS_MAX_PHONE_LENGTH]; // copy the monophone string // strcpy((char*)temp_models[num_spm_a], (char*)tmp); num_spm_a++; } // reset the temporary buffer // tmp = (char_1*)memset(tmp, (int_4)0, ISIP_MAX_STRING_LENGTH); } special_models = new char_1*[num_spm_a]; for(int i = 0; i<num_spm_a; i++) { special_models[i] = new char_1[strlen((char*)temp_models[i])+1]; strcpy((char*)special_models[i], (char*)temp_models[i]); } // free memory // delete [] tmp; for(int i = 0; i< num_spm_a; i++) { delete [] temp_models[i]; } delete [] temp_models; // exit gracefully // return special_models;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -