0001 function pitchedIndex=lab2pitchedIndex(labFile, qiYinFile)
0002
0003
0004
0005
0006
0007
0008
0009 if nargin<1, selfdemo; return; end
0010 if nargin<2
0011 [parentDir, junk, junk, junk]=fileparts(which(mfilename));
0012 qiYinFile='d:\users\jang\matlab\toolbox\asr\exe\dict\hanyu.qiYin';
0013 end
0014
0015 word = labRead(labFile);
0016 qiYin = textread(qiYinFile,'%s','delimiter','\n','whitespace','');
0017 pitchedIndex=[];
0018 for i=1:length(word)
0019 wordName=word(i).name;
0020 for j=1:length(word(i).phone)
0021 startIndex=word(i).phone(j).time(1)/100000+1;
0022 endIndex=word(i).phone(j).time(2)/100000;
0023 phoneName=word(i).phone(j).name;
0024 plusIndex=findstr(phoneName, '+');
0025 monoPhoneName=phoneName;
0026 if length(plusIndex)==1
0027 monoPhoneName=phoneName(1:plusIndex-1);
0028 end
0029
0030 index=find(strcmp(qiYin, monoPhoneName));
0031 if isempty(index)
0032 pitchedIndex=[pitchedIndex, startIndex:endIndex];
0033 end
0034
0035 end
0036 end
0037
0038
0039 function selfdemo
0040 labFile='但使龍城飛將在.lab';
0041 qiYinFile='d:\users\jang\matlab\toolbox\asr\exe\dict\hanyu.qiYin';
0042 pitchedIndex=feval(mfilename, labFile, qiYinFile)