C++实现语音识别词典内存存储模型(二)
j>i ; j-- ){
words[j] = words[j-1] ;
nPronuns[j] = nPronuns[j-1] ;
}
words[i] = new char[strlen(word)+1] ;
strcpy( words[i] , word ) ;
nPronuns[i] = 0 ;
ind = i ;
break ;
}else if ( cmpResult == 0 ){
//词已经存在
ind = i ;
break ;
}
}
}
if ( ind < 0 )
error("添加词失败 < 0") ;
if ( registerPronun ){
(nPronuns[ind])++ ; //注册词的发音
}
return ind ; //返回序号
}