function [computedClass_Word, correctCount, allConf, sylConf, hitIndex, missIndex, missComputedPos] = classifyPostprocess(classifier, testID, testLabel, computedClass, score, data, allConf, sylConf) computedClass_Word = ones(size(testID)) + ones(size(testID)); correctCount = 0; hitIndex = []; missIndex = []; missComputedPos = []; switch(classifier) case 'svmc' count = computedClass; count(count==2) = 0; index = min(find(computedClass==1)); % Due to svm's probability estimation random side for n = min(testID):max(testID) startIndex = min(find(n==testID)); % Word index endIndex = max(find(n==testID)); % Word index temp = sum(count(startIndex:endIndex)); if score(index)>0 if temp>1 [prob, stressPos] = max(score(startIndex:endIndex)); elseif temp==0 [prob, stressPos] = max(score(startIndex:endIndex)); elseif temp==1 stressPos = find(computedClass(startIndex:endIndex)==1); end else if temp>1 [prob, stressPos] = min(score(startIndex:endIndex)); elseif temp==0 [prob, stressPos] = min(score(startIndex:endIndex)); elseif temp==1 stressPos = find(computedClass(startIndex:endIndex)==1); end end computedClass_Word(startIndex+stressPos-1) = 1; switch(data.stressNum(n)) case 2 sylConf.pos2 = [sylConf.pos2, stressPos]; sylConf.gt2 = [sylConf.gt2, data.stressPos(n)]; case 3 sylConf.pos3 = [sylConf.pos3, stressPos]; sylConf.gt3 = [sylConf.gt3, data.stressPos(n)]; case 4 sylConf.pos4 = [sylConf.pos4, stressPos]; sylConf.gt4 = [sylConf.gt4, data.stressPos(n)]; case 5 sylConf.pos5 = [sylConf.pos5, stressPos]; sylConf.gt5 = [sylConf.gt5, data.stressPos(n)]; case 6 sylConf.pos6 = [sylConf.pos6, stressPos]; sylConf.gt6 = [sylConf.gt6, data.stressPos(n)]; case 7 sylConf.pos7 = [sylConf.pos7, stressPos]; sylConf.gt7 = [sylConf.gt7, data.stressPos(n)]; case 8 sylConf.pos8 = [sylConf.pos8, stressPos]; sylConf.gt8 = [sylConf.gt8, data.stressPos(n)]; end allConf.predictPos = [allConf.predictPos, stressPos]; allConf.gtPos = [allConf.gtPos, data.stressPos(n)]; if sum(computedClass_Word(startIndex:endIndex)==testLabel(startIndex:endIndex)) == (endIndex-startIndex+1) correctCount = correctCount + 1; hitIndex = [hitIndex, n]; else missIndex = [missIndex, n]; missComputedPos = [missComputedPos, stressPos]; end end case {'qc', 'nbc', 'gmmc', 'src'} count = computedClass; count(count==2) = 0; for n = min(testID):max(testID) startIndex = min(find(n==testID)); % Word index endIndex = max(find(n==testID)); % Word index temp = sum(count(startIndex:endIndex)); % if temp>1 % [prob, stressPos] = max(score(1, startIndex:endIndex)); % elseif temp==0 % [prob, stressPos] = min((score(2, startIndex:endIndex))); % elseif temp==1 % stressPos = find(computedClass(startIndex:endIndex)==1); % end [prob, stressPos] = max(score(1,startIndex:endIndex) - score(2,startIndex:endIndex)); computedClass_Word(startIndex+stressPos-1) = 1; switch(data.stressNum(n)) case 2 sylConf.pos2 = [sylConf.pos2, stressPos]; sylConf.gt2 = [sylConf.gt2, data.stressPos(n)]; case 3 sylConf.pos3 = [sylConf.pos3, stressPos]; sylConf.gt3 = [sylConf.gt3, data.stressPos(n)]; case 4 sylConf.pos4 = [sylConf.pos4, stressPos]; sylConf.gt4 = [sylConf.gt4, data.stressPos(n)]; case 5 sylConf.pos5 = [sylConf.pos5, stressPos]; sylConf.gt5 = [sylConf.gt5, data.stressPos(n)]; case 6 sylConf.pos6 = [sylConf.pos6, stressPos]; sylConf.gt6 = [sylConf.gt6, data.stressPos(n)]; case 7 sylConf.pos7 = [sylConf.pos7, stressPos]; sylConf.gt7 = [sylConf.gt7, data.stressPos(n)]; case 8 sylConf.pos8 = [sylConf.pos8, stressPos]; sylConf.gt8 = [sylConf.gt8, data.stressPos(n)]; end allConf.predictPos = [allConf.predictPos, stressPos]; allConf.gtPos = [allConf.gtPos, data.stressPos(n)]; if sum(computedClass_Word(startIndex:endIndex)==testLabel(startIndex:endIndex)) == (endIndex-startIndex+1) correctCount = correctCount + 1; hitIndex = [hitIndex, n]; else missIndex = [missIndex, n]; missComputedPos = [missComputedPos, stressPos]; end end end