-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessclusters.m
More file actions
61 lines (55 loc) · 2.5 KB
/
processclusters.m
File metadata and controls
61 lines (55 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const_phonfraction = 0.5 ;
% find the phonemes in the clusters
%
% female first
%
% deal with PCA first
for i = 1:n_clusters_pca % for each cluster
pcaphonemes{i} = f1.segmentphoneme(line1to8_km5_pca == i) ; % find the phonemes in this cluster
% find the list of phonemes, and the index in that list of each
[pcaphonemesunique{i}, ~, pcaphuid{i}] = unique(pcaphonemes{i}) ;
% now find the most frequently occurring phonemes in each of the
% n_clusters_pca lists.
numphonemes = length(pcaphonemes{i}) ;
% intiialise arrays
modeno = zeros([1 floor(numphonemes/2)]) ;
phonfreq = zeros([1 floor(numphonemes/2)]) ;
totalfrequency = 0 ;
phonsinlist = 0 ;
pcaphuidtemp = pcaphuid{i} ;
while (totalfrequency < (numphonemes * const_phonfraction))
phonsinlist = phonsinlist + 1 ;
[modeno(phonsinlist), phonfreq(phonsinlist)] = mode(pcaphuidtemp) ;
pcaphuidtemp= pcaphuidtemp(pcaphuidtemp ~= modeno(phonsinlist)) ;
totalfrequency = totalfrequency + phonfreq(phonsinlist) ;
end
%modeno now has the most common phonemes indexes, and phonfreq has the
%frequency of each. Now put the actual phoneme into an array
pcamodephonemes{i} = pcaphonemesunique{i}(modeno(1:phonsinlist)) ;
pcaphonfreqclust{i} = phonfreq(1:phonsinlist) ;
end
% and ICAs
for i = 1:n_clusters_ica % for each cluster
icaphonemes{i} = f1.segmentphoneme(line1to8_km5_ica == i) ; % find the phonemes in this cluster
% find the list of phonemes, and the index in that list of each
[icaphonemesunique{i}, ~, icaphuid{i}] = unique(icaphonemes{i}) ;
% now find the most frequently occurring phonemes in each of the
% n_clusters_pca lists.
numphonemes = length(icaphonemes{i}) ;
% intiialise arrays
modeno = zeros([1 floor(numphonemes/2)]) ;
phonfreq = zeros([1 floor(numphonemes/2)]) ;
totalfrequency = 0 ;
phonsinlist = 0 ;
icaphuidtemp = icaphuid{i} ;
while (totalfrequency < (numphonemes * const_phonfraction))
phonsinlist = phonsinlist + 1 ;
[modeno(phonsinlist), phonfreq(phonsinlist)] = mode(icaphuidtemp) ;
icaphuidtemp= icaphuidtemp(icaphuidtemp ~= modeno(phonsinlist)) ;
totalfrequency = totalfrequency + phonfreq(phonsinlist) ;
end
%modeno now has the most common phonemes indexes, and phonfreq has the
%frequency of each. Now put the actual phoneme into an array
icamodephonemes{i} = icaphonemesunique{i}(modeno(1:phonsinlist)) ;
icaphonfreqclust{i} = phonfreq(1:phonsinlist) ;
end