Home > asr > forwardBackwardAnalysis.m

forwardBackwardAnalysis

PURPOSE ^

SYNOPSIS ^

function waveDataElement=forwardBackwardAnalysis(waveDataElement, recogParam)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function waveDataElement=forwardBackwardAnalysis(waveDataElement, recogParam)
0002 
0003 plotOpt=0;
0004 tStart=clock;
0005 
0006 % ====== Forward assessment
0007 text1=waveDataElement.text;
0008 switch lower(recogParam.language)
0009     case 'chinese'
0010     case 'english'
0011     case 'japanese'
0012         sylSeq=strrep(waveDataElement.syl, ' ', '-'); fid=fopen(recogParam.sylFile, 'w'); fprintf(fid, '%s\t%d\n', sylSeq, 0); fclose(fid);
0013     otherwise
0014         error(sprintf('Unknown language "%s"!', recogParam.language));
0015 end
0016 cmFile1=[tempname, '.cm1']; labFile1=[tempname, '.lab1']; plpFile1=[tempname, '.plp1'];
0017 [waveDataElement.cm1, waveDataElement.dosCmd1, waveDataElement.time1, waveDataElement.exeStatus1, waveDataElement.exeResult1]=waveAssess(waveDataElement.path, text1, recogParam, plotOpt, [], cmFile1, labFile1, plpFile1);
0018 
0019 % ====== Backward assessment
0020 switch lower(recogParam.language)
0021     case 'chinese'
0022         text2=fliplr(text1);
0023     case 'english'
0024         items=split(text1, ' '); items=fliplr(items); text2=join(items, ' ');
0025     case 'japanese'
0026         sylSeq=join(fliplr(split(waveDataElement.syl, ' ')), '-'); fid=fopen(recogParam.sylFile, 'w'); fprintf(fid, '%s\t%d\n', sylSeq, 0); fclose(fid);
0027         text2=text1;    % This is not use for scoring at all.
0028     otherwise
0029         error(sprintf('Unknown language "%s"!', recogParam.language));
0030 end
0031 cmFile2=[tempname, '.cm2']; labFile2=[tempname, '.lab2']; plpFile2=[tempname, '.plp2'];
0032 [waveDataElement.cm2, waveDataElement.dosCmd2, waveDataElement.time2, waveDataElement.exeStatus2, waveDataElement.exeResult2]=waveAssess(waveDataElement.path, text2, recogParam, plotOpt, [], cmFile2, labFile2, plpFile2);
0033 
0034 % ====== Keep time and read plpFile
0035 waveDataElement.time=etime(clock, tStart);
0036 
0037 return
0038 
0039 waveDataElement.plp=plpRead(plpFile1);
0040 % Delete temp files
0041 delete(cmFile1); delete(labFile1); delete(plpFile1);
0042 delete(cmFile2); delete(labFile2); delete(plpFile2);

Generated on Tue 01-Jun-2010 09:50:19 by m2html © 2003