0001 function word=cmWordBgPlot(cmObj, minY, maxY)
0002
0003
0004
0005
0006
0007
0008
0009
0010 if nargin<1; selfdemo; return; end
0011
0012 if isstr(cmObj)
0013 deleteSil=0;
0014 output=asraOutputXmlRead(cmObj);
0015 cmObj=output.confidenceMeasure;
0016 end
0017
0018 word=cmObj.word;
0019 cla;
0020 for i=1:length(word);
0021
0022 time=word(i).interval;
0023 if length(word(i).phone(1).name)>=4
0024 if strcmp(word(i).phone(1).name(1:4), 'sil+') & length(word(i).phone)>1
0025 time(1)=word(i).phone(2).interval(1);
0026 end
0027 end
0028 xPos=mean(time); yPos=maxY;
0029 temp=strrep(word(i).name, '_', '\_');
0030 word(i).textH=text(xPos, yPos, {[word(i).text, '(', temp, ')'], int2str(word(i).timberScore)}, 'horizontal', 'center');
0031 set(word(i).textH, 'horizontal', 'center', 'vertical', 'bottom');
0032
0033 if strcmp(word(i).name, 'sil')|strcmp(word(i).name, 'sp')
0034 color='w';
0035 else
0036 color=getColorLight(i);
0037 end
0038 word(i).patchH=patch(time([1 2 2 1]), [minY minY maxY maxY], color);
0039 set(word(i).patchH, 'edgeColor', 'k');
0040
0041 phoneNum=length(word(i).phone);
0042 for j=1:phoneNum
0043
0044 time=word(i).phone(j).interval;
0045 line(time(1)*[1 1], [minY maxY], 'color', 'k');
0046 line(time(2)*[1 1], [minY maxY], 'color', 'k');
0047
0048 xPos=mean(time); yPos=minY;
0049 phoneName=word(i).phone(j).name;
0050 phoneScore=word(i).phone(j).timberScore;
0051 plusPos=findstr(phoneName, '+');
0052 phoneName=phoneName(1:plusPos-1);
0053 word(i).phone(j).textH=text(xPos, yPos, {phoneName, int2str(phoneScore)}, 'horizontal', 'center');
0054 set(word(i).phone(j).textH, 'horizontal', 'center', 'vertical', 'bottom');
0055 end
0056 end
0057 temp=[cmObj.discountFactor];
0058 discountFactor=[temp.occurrence];
0059 ylabel({sprintf('Score=%.2f\n', cmObj.score), sprintf('df=%s', mat2str(discountFactor))});
0060
0061
0062 function selfdemo
0063 wavFile='what_would_you_like_to_know.wav';
0064 xmlFile='what_would_you_like_to_know.xml';;
0065 feval(mfilename, xmlFile, -1, 1);
0066 [y, fs, nbits]=wavread(wavFile);
0067 time=(1:length(y))/fs;
0068 waveH=line(time, y);
0069 axis([min(time), max(time), -1, 1]);
0070 box on