wrd_phone_5.cc
来自「这是处理语音信号的程序」· CC 代码 · 共 75 行
CC
75 行
// file: wrd_phone_5.cc// // isip include files//#include "word.h"#include "word_constants.h" // method: add_pron_cc//// arguments:// int_4 num_ph: (input) number of phones in this pronunciation// int_4* phones: (input) array of phones for this prnunciation//// return: a logical_1 flag indicating success//// this method adds a pronunciation to an existing word//logical_1 Word::add_pron_cc(int_4 num_ph_a, int_4* phones_a) { // assign the pronunciations only if valid // if (num_ph_a <= (int_4)0) { return ISIP_FALSE; } // update number of pronunciations // num_prons_d++; // create temporary memory // int_4** phlist = new int_4*[num_prons_d]; int_4* numph = new int_4[num_prons_d]; // copy the pronunciations // for (int_4 i = 0; i < num_prons_d - 1; i++) { numph[i] = num_phones_d[i]; phlist[i] = new int_4[numph[i]]; for (int_4 j = 0; j < numph[i]; j++) { phlist[i][j] = phone_list_d[i][j]; } } // add the new pronunciation // numph[num_prons_d - 1] = num_ph_a; phlist[num_prons_d - 1] = new int_4[num_ph_a]; for (int_4 j = 0; j < num_ph_a; j++) { phlist[num_prons_d - 1][j] = phones_a[j]; } // copy the arrays over // if (num_phones_d != (int_4*)NULL) { delete [] num_phones_d; } if (phone_list_d != (int_4**)NULL) { for (int_4 i = 0; i < num_prons_d - 1; i++) { delete [] phone_list_d[i]; } delete [] phone_list_d; } // copy the pointers // phone_list_d = phlist; num_phones_d = numph; // exit gracefully // return ISIP_TRUE;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?