📄 label6st.m
字号:
disp(' ');
disp('SCRIPT: label6st.m **************************************************');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% label6st.m
%
% jmw
% 3/1/94
% 2/24/94
% 2/4/94
% 1/26/94
%
% overrides highest score if vowel score > 0.45
% BUT ONLY AFTER A PREVIOUS (POSITIVE VOWEL i.e. >0.45) FRAME
%
% and saves resulting first and second choices for each frame along
% with reliability indicators
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
file_string = sprintf('temp/%s.mat', name);
s=sprintf('loading ./%s from hard disk ...',file_string);
disp(s);
s=sprintf('load %s', file_string);
eval(s);
signal = eval(name);
file_string = sprintf('temp/%s_Data.mat', name);
s=sprintf('loading ./%s from hard disk ...',file_string);
disp(s);
s=sprintf('load %s', file_string);
eval(s);
file_string = sprintf('temp/%s_SMVscore.mat', name);
s=sprintf('loading ./%s from hard disk ...',file_string);
disp(s);
s=sprintf('load %s', file_string);
eval(s);
file_string = sprintf('temp/%s_VWLscore.mat', name);
s=sprintf('loading ./%s from hard disk ...',file_string);
disp(s);
s=sprintf('load %s', file_string);
eval(s);
file_string = sprintf('temp/%s_NASscore.mat', name);
s=sprintf('loading ./%s from hard disk ...',file_string);
disp(s);
s=sprintf('load %s', file_string);
eval(s);
file_string = sprintf('temp/%s_BARscore.mat', name);
s=sprintf('loading ./%s from hard disk ...',file_string);
disp(s);
s=sprintf('load %s', file_string);
eval(s);
file_string = sprintf('temp/%s_VFRscore.mat', name);
s=sprintf('loading ./%s from hard disk ...',file_string);
disp(s);
s=sprintf('load %s', file_string);
eval(s);
file_string = sprintf('temp/%s_UFRscore.mat', name);
s=sprintf('loading ./%s from hard disk ...',file_string);
disp(s);
s=sprintf('load %s', file_string);
eval(s);
file_string = sprintf('temp/%s_USTscore.mat', name);
s=sprintf('loading ./%s from hard disk ...',file_string);
disp(s);
s=sprintf('load %s', file_string);
eval(s);
file_string = sprintf('temp/%s_NewSegdata.mat', name);
s=sprintf('loading ./%s from hard disk ...',file_string);
disp(s);
s=sprintf('load %s', file_string);
eval(s);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% compute scores for each segment or subsegment
VWL_SUM = zeros(1,new_seg_cnt);
SMV_SUM = zeros(1,new_seg_cnt);
NAS_SUM = zeros(1,new_seg_cnt);
BAR_SUM = zeros(1,new_seg_cnt);
VFR_SUM = zeros(1,new_seg_cnt);
UFR_SUM = zeros(1,new_seg_cnt);
UST_SUM = zeros(1,new_seg_cnt);
for j=1:new_seg_cnt,
a = new_seg_frame(j,1);
b = new_seg_frame(j,2);
R = b - a + 1;
if ( new_seg_type(j) == 's')
;
elseif ( new_seg_type(j) == 'v')
VWL_SUM(j) = (sum(vwl_score(a:b))) / R;
SMV_SUM(j) = (sum(smv_score(a:b))) / R;
NAS_SUM(j) = (sum(nas_score(a:b))) / R;
BAR_SUM(j) = (sum(bar_score(a:b))) / R;
VFR_SUM(j) = (sum(vfr_score(a:b))) / R;
elseif ( new_seg_type(j) == 'u')
UFR_SUM(j) = (sum(ufr_score(a:b))) / R;
UST_SUM(j) = (sum(ust_score(a:b))) / R;
end;
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
message_win_results=figure('Unit','normalized',...
'Position',[0.05 0.05 0.70 0.7],...
'Resize','on',...
'Color',BACK_COLOR,...
'Numbertitle','off',...
'Name','Message');
axis('off');
ss1=sprintf('The data in this window may be printed if desired, then please close the window.');
text(-0.05,1.,ss1,'color',TEXT_COLOR,'FontSize',8);
ss2=sprintf('The data for only about 15 segments can be printed in this figure, but all data are stored.');
Ta=0.03;
Tc=1.0 - Ta ;
text(-0.05,Tc,ss2,'color',TEXT_COLOR,'FontSize',8);
%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% list tabulated results
disp(' ');
disp(' ');
s1=sprintf('SEGMENT TYPE DURAT. VOWEL SEMIVWL NASAL BAR');
s2=sprintf(' V-FRIC');
s3 = sprintf(' U-FR U-ST');
disp([s1 s2 s3]);disp(' ');
%%%%%%%%%%%%%%%%%%%%%%%%
%for message window
ss_titles=[s1 s2 s3];
Tc=Tc-Ta;
text(-0.05,Tc,ss_titles,'color',TEXT_COLOR,'FontSize',8);
%%%%%%%%%%%%%%%%%%%%%%%%
for j=1:new_seg_cnt,
dur = (new_seg_range(j,2)-new_seg_range(j,1)+1)/10;
s1=sprintf('%d %s %5.1f ',j,new_seg_type(j), dur);
s2=sprintf(' %4.2f ',VWL_SUM(j));
s3=sprintf(' %4.2f %4.2f ', SMV_SUM(j) , NAS_SUM(j));
s4=sprintf('%4.2f %4.2f ' , BAR_SUM(j), VFR_SUM(j));
s5=sprintf('%4.2f %4.2f', UFR_SUM(j), UST_SUM(j));
disp([s1 s2 s3 s4 s5]);
%%%%%%%%%%%%%%%%%%%%%%%%%
%for message window
%axis('off');
ss_data=[s1 s2 s3 s4 s5];
Tc=Tc-Ta;
text(-0.05, Tc,ss_data, 'color', TEXT_COLOR, 'FontSize',8);
%%%%%%%%%%%%%%%%%%%%%%%%%%
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% find 1st and second choices
disp(' ');
disp(' ');
s1=sprintf('SEGMENT TYPE DURAT. FIRST CHOICE (%%)');
s2=sprintf(' SECOND CHOICE (%%)');
disp([s1 s2]);
%disp(' ');
%%%%%%%%%%%%%%%%%%%%%%
%for message window
ss_choice_titles=[s1 s2];
Tc=Tc-Ta;
text(-0.05,Tc,ss_choice_titles,'color',TEXT_COLOR,'FontSize',8);
%%%%%%%%%%%%%%%%%%%%%%
reliability_1 = zeros(new_seg_cnt,1);
reliability_2 = zeros(new_seg_cnt,1);
for j=1:new_seg_cnt,
if (new_seg_type(j) == 'v')
ALL_SUM=[VWL_SUM(j) SMV_SUM(j) NAS_SUM(j) BAR_SUM(j) VFR_SUM(j)];
TOTAL_SUM = sum(ALL_SUM);
if (TOTAL_SUM==0)
TOTAL_SUM = 1;
end;
[SORT_SUM, SORT_SUM_INDEX] = sort(ALL_SUM);
% first choice
if (SORT_SUM_INDEX(5)==1)
%first choice is vowel
choice_1(j,:) = ' vowel';
reliability_1(j) = VWL_SUM(j) / TOTAL_SUM;
elseif(SORT_SUM_INDEX(5)==2)
%first choice is semivowel
choice_1(j,:) = 'semivowel';
reliability_1(j) = SMV_SUM(j) / TOTAL_SUM;
elseif(SORT_SUM_INDEX(5)==3)
%first choice is nasal
choice_1(j,:) = ' nasal';
reliability_1(j) = NAS_SUM(j) / TOTAL_SUM;
elseif(SORT_SUM_INDEX(5)==4)
%first choice is voicebar
choice_1(j,:) = ' voicebar';
reliability_1(j) = BAR_SUM(j) / TOTAL_SUM;
elseif(SORT_SUM_INDEX(5)==5)
%first choice is voicefric
choice_1(j,:) = ' voicfric';
reliability_1(j) = VFR_SUM(j) / TOTAL_SUM;
end;
% get second choice
if (SORT_SUM_INDEX(4)==1)
%2nd choice is vowel
choice_2(j,:) = ' vowel';
reliability_2(j) = VWL_SUM(j) / TOTAL_SUM;
elseif(SORT_SUM_INDEX(4)==2)
%2nd choice is semivowel
choice_2(j,:) = 'semivowel';
reliability_2(j) = SMV_SUM(j) / TOTAL_SUM;
elseif(SORT_SUM_INDEX(4)==3)
%first choice is nasal
choice_2(j,:) = ' nasal';
reliability_2(j) = NAS_SUM(j) / TOTAL_SUM;
elseif(SORT_SUM_INDEX(4)==4)
%2nd choice is voicebar
choice_2(j,:) = ' voicebar';
reliability_2(j) = BAR_SUM(j) / TOTAL_SUM;
elseif(SORT_SUM_INDEX(4)==5)
%2nd choice is voicefric
choice_2(j,:) = ' voicfric';
reliability_2(j) = VFR_SUM(j) / TOTAL_SUM;
end;
% check to override score if vowel score > 0.45
% and vowel not first choice
flag = 0;
if (~strcmp(choice_1(j,:),' vowel') & VWL_SUM(j) >= 0.45)
if(strcmp(choice_1(j-1,:),' vowel'))
if(reliability_2(j) > 0.35) %changed from 0.4 3/94
% only do if previous frame a vowel
disp('vowel/vowel override next frame');
choice_2(j,:) = choice_1(j,:);
reliability_2(j) = reliability_1(j);
choice_1(j,:) = ' vowel';
reliability_1(j) = VWL_SUM(j) / TOTAL_SUM;
flag = 1;
end;
end;
end;
% check to override score if vowel score < 0.50
% and vowel is first choice
if (strcmp(choice_1(j,:),' vowel')&VWL_SUM(j)<0.50 &flag==0)
if (reliability_2(j) > 0.1)
% dont switch if 2nd choice is zero reliability
disp('consonant override next frame');
temp_choice(1,:) = choice_2(j,:);
temp_reliability = reliability_2(j);
choice_2(j,:) = choice_1(j,:);
reliability_2(j) = reliability_1(j);
choice_1(j,:) = temp_choice(1,:);
reliability_1(j) = temp_reliability;
end;
end;
dur = (new_seg_range(j,2)-new_seg_range(j,1)+1)/10;
s1=sprintf('%d %s %5.1f', j, new_seg_type(j), dur);
s2=sprintf('%s (%4.2f)', choice_1(j,:), reliability_1(j));
s3=sprintf('%s (%4.2f)', choice_2(j,:), reliability_2(j));
disp([s1 s2 s3]);
%%%%%%%%%%%%%%%%%%%%%%%%
%for message window
ss_choice_data=[s1 s2 s3];
Tc=Tc-Ta;
text(-0.05,Tc,ss_choice_data,'color',TEXT_COLOR,'FontSize',8);
%%%%%%%%%%%%%%%%%%%%%%%%
elseif (new_seg_type(j) == 's')
choice_1(j,:) = ' silent';
choice_2(j,:) = ' none';
%reliability_1(j) = 1;
dur = (new_seg_range(j,2)-new_seg_range(j,1)+1)/10;
s1=sprintf('%d %s %5.1f', j, new_seg_type(j), dur);
s2=sprintf(' %s ', choice_1(j,:));
disp([s1 s2 ]);
%%%%%%%%%%%%%%%%%%%%%%%%
%for message window
ss_choice_data=[s1 s2];
Tc=Tc-Ta;
text(-0.05,Tc,ss_choice_data,'color',TEXT_COLOR,'FontSize',8);
%%%%%%%%%%%%%%%%%%%%%%%%
elseif (new_seg_type(j) == 'u')
ALL_SUM = [UFR_SUM(j) UST_SUM(j)];
TOTAL_SUM = sum(ALL_SUM);
if (TOTAL_SUM==0)
TOTAL_SUM = 1;
end;
[SORT_SUM, SORT_SUM_INDEX] = sort(ALL_SUM);
if (SORT_SUM_INDEX(2)==1)
%first choice is UNV FRIC
choice_1(j,:) = ' unv fric';
choice_2(j,:) = ' unv stop';
reliability_1(j) = UFR_SUM(j) / TOTAL_SUM;
reliability_2(j) = UST_SUM(j) / TOTAL_SUM;
elseif(SORT_SUM_INDEX(2)==2)
%first choice is UNV STOP
choice_1(j,:) = ' unv stop';
choice_2(j,:) = ' unv fric';
reliability_1(j) = UST_SUM(j) / TOTAL_SUM;
reliability_2(j) = UFR_SUM(j) / TOTAL_SUM;
end;
dur = (new_seg_range(j,2)-new_seg_range(j,1)+1)/10;
s1=sprintf('%d %s %5.1f', j, new_seg_type(j), dur);
s2=sprintf('%s (%4.2f)', choice_1(j,:), reliability_1(j));
s3=sprintf('%s (%4.2f)', choice_2(j,:), reliability_2(j));
disp([s1 s2 s3]);
%%%%%%%%%%%%%%%%%%%%%%%%
%for message window
ss_choice_data=[s1 s2 s3];
Tc=Tc-Ta;
text(-0.05,Tc,ss_choice_data,'color',TEXT_COLOR,'FontSize',8);
%%%%%%%%%%%%%%%%%%%%%%%%
end;
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% save results to file
disp(' ');
disp(' ');
s=sprintf('saving ./%s_Labels to hard disk ...', name);
disp(s);
s=sprintf('save temp/%s_Labels choice_1 choice_2 reliability_1 reliability_2',name);
eval(s);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% clean up time...
clear ALL_SUM choice_1 residue
clear BAR_SUM choice_2 s1
clear NAS_SUM cofa s2
clear R dur s3
clear SMV_SUM file_string s4
clear SORT_SUM j s5
clear SORT_SUM_INDEX signal
clear TOTAL_SUM nas_score smv_score
clear UFR_SUM new_seg_cnt ufr_score
clear UST_SUM new_seg_frame ust_score
clear VFR_SUM new_seg_range vfr_score
clear VUS_voicetype new_seg_type voicetype
clear VWL_SUM power vwl_score
clear a range flag
clear b reliability_1 temp_choice
clear bar_score reliability_2 temp_reliability
clear ss1 ss2 ss_data ss_titles ss_choice_titles ss_choice_data Tc Ta
s=sprintf('clear %s',name);
eval(s);
clear s;
message_win3_f=figure('Unit','normalized',...
'Position',[0.05 0.2 0.6 0.2],...
'Resize','off',...
'Color',BACK_COLOR,...
'Numbertitle','off',...
'Name','Message');
axis('off');
ss=sprintf('The results have been saved to disk.');
text(-0.05,1,ss,'color',[0 0 1],'FontSize',10);
axis('off');
%ss=sprintf('The results are only printed to the Matlab Command window at this time.');
%text(-0.05,2/3,ss,'color',TEXT_COLOR,'FontSize',10);
axis('off');
ss=sprintf('This window will close in 6 seconds.');
text(-0.05,2/3,ss,'color',[0 0 1],'FontSize',10);
pause(6.0);
close(message_win3_f);
clear message_win3_f;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -