欢迎来到天天文库
浏览记录
ID:55603864
大小:49.50 KB
页数:12页
时间:2020-05-20
《利用HMM孤立字词语音识别系统.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、利用HMM的孤立字(词)语音识别系统/*************************************************************************//*文件名称:recog.cpp(主程序)*//****************************************************************************/#include"emhmm.h"intBR_Disp[MAX_ARCS];/*Displaymenttosavem
2、ultiplies(branch_prob)*/intME_Disp[MAX_ARCS];/*Displaymenttosavemnltiplies(mean)*/intCO_Disp[MAX_ARCS];/*Displaymenttosavemultiplies(covariance)*/intTrain_Disp[MAX_ARCS+MAX_STATES];/*reallyonlyneedmax(ma,ms)*/imNum_Dimensions;intNum_Train_Sets;/*Sizeof
3、dimensionoftrainingdata*/intTotal_Frames;intLongest_Train;/*thelengthofthelongesttrainingset*/TRAININGTrain[MAX-_TRAIN_SIZE];HMMHmm[MAX_REF];main(argc,argv)intargc;char*argv[];{inti,num_ref,result;intcnt[MAX_REF];stringhmm_file;char*infile=NULL,*ref_li
4、st=NULL;charch_r[MAX_REF][8];FILE*fp;/*****************命令行参数设置****************/if(argc<5)usage(argv[0]);for(i=1;i5、reak;case'i':in_file=argv[++i];break;default:fprimf(stderr,"Illegalswitch%s',argv[i]);usage(argv[0]);break;}}/*****************************读取参考模型的数量,即词表的大小*****************************/if((fp=fopen(ref_list,"r"))==NULL){fprinff(stderr,"%s:can'topen%s6、toread.',ref_list);exit(0);}fscanf(fp,'%d',&num_ref);/*************读取模型的参数************/for(i=0;i7、****读取待识别语音的数据******************/if((Num_Train_Sets=read_training(in_file))>MAX_TRAIN_SIZE){fprintf(stderr,'%s:toomanytestpatternsin%s.",argv[0],in_file);exit(0);}/***********识别**********/for(i=0;i8、result];#ifTRACEprintf("[%3d]%3d:%s",i+1,Train[i].length,ch_r[result]);fflush(stdout);#endiffree(Train[i].data);}printf("###识别结果###");for(i=0;i
5、reak;case'i':in_file=argv[++i];break;default:fprimf(stderr,"Illegalswitch%s',argv[i]);usage(argv[0]);break;}}/*****************************读取参考模型的数量,即词表的大小*****************************/if((fp=fopen(ref_list,"r"))==NULL){fprinff(stderr,"%s:can'topen%s
6、toread.',ref_list);exit(0);}fscanf(fp,'%d',&num_ref);/*************读取模型的参数************/for(i=0;i7、****读取待识别语音的数据******************/if((Num_Train_Sets=read_training(in_file))>MAX_TRAIN_SIZE){fprintf(stderr,'%s:toomanytestpatternsin%s.",argv[0],in_file);exit(0);}/***********识别**********/for(i=0;i8、result];#ifTRACEprintf("[%3d]%3d:%s",i+1,Train[i].length,ch_r[result]);fflush(stdout);#endiffree(Train[i].data);}printf("###识别结果###");for(i=0;i
7、****读取待识别语音的数据******************/if((Num_Train_Sets=read_training(in_file))>MAX_TRAIN_SIZE){fprintf(stderr,'%s:toomanytestpatternsin%s.",argv[0],in_file);exit(0);}/***********识别**********/for(i=0;i8、result];#ifTRACEprintf("[%3d]%3d:%s",i+1,Train[i].length,ch_r[result]);fflush(stdout);#endiffree(Train[i].data);}printf("###识别结果###");for(i=0;i
8、result];#ifTRACEprintf("[%3d]%3d:%s",i+1,Train[i].length,ch_r[result]);fflush(stdout);#endiffree(Train[i].data);}printf("###识别结果###");for(i=0;i
此文档下载收益归作者所有