PEMROSESAN BAHASA ALAMI codebook PEMROSESAN BAHASA ALAMI
CodeBook Code book merupakan salah teknik untuk melakukan pengenalan berbasis jarak Tahap Data hasil ekstraksi ciri Lakukan klastering Hitung jarak setiap data uji terhadap anggota cluster (codeword) Ambil jarak minimum setiap data uji ke data latih Hitung total jarak minimum setiap kelas Bandingkan Ambil yang paling minimum
Example There are two class of signals : z and y z have two training data y have two training data We are using mfcc with 5 Cepstrum Coefficient We are using kmeans and codebook with three codewords
Training data, after mfcc z{1}= [ 4.0044 4.1856 8.0696 6.3278 8.1128 10.2260 0.2177 0.3073 -0.0025 2.2093 2.5361 2.2863 -0.2909 -0.1256 0.1222 0.2727 0.0405 -1.2725 -0.0850 -0.0787 0.1232 0.2019 -0.2277 -1.0746 -0.1214 -0.1909 0.0884 -0.0370 -0.4269 -1.1268 ]
Training data z{2}= [ -0.1873 0.0335 -0.1928 -0.3006 -0.6132 -0.2678 -0.1231 0.0771 -0.6213 -0.1611 0.0779 0.5110 -0.0106 -0.2889 -0.6583 0.0156 0.1699 0.5658 0.2172 -0.1252 -0.6871 -0.5324 -0.5785 -0.5386 0.2583 0.0267 -0.5026 -0.1013 0.1435 0.2852 ]
Training data y{1}= [ 4.7608 3.8921 4.2835 7.1905 8.2474 10.0080 0.0407 0.3190 0.2916 0.8016 1.4601 1.7999 -0.1334 -0.1925 -0.4114 0.2943 -0.0699 -1.2339 -0.1844 0.1873 -0.3004 0.0757 -0.0235 -1.3585 -0.2420 0.2137 -0.3556 0.0521 -0.2482 -0.5764 ]
Training data y{2} = [ -0.0463 0.1805 0.0031 0.1331 -0.3234 -0.4808 0.1873 0.0672 -0.0587 -0.1563 -0.1065 0.5782 -0.2422 -0.0752 -0.2039 -0.3196 0.2894 0.7126 -0.4076 -0.2417 -0.3764 -0.4488 -0.3783 -0.7561 -0.4517 -0.2601 -0.4371 -0.1502 0.0342 0.5024]
Testing data, another signal (z/y ?) c = [ -0.3559 -0.2604 0.0499 -0.1349 -0.1636 0.0684 -0.1981 -0.4490 -0.2895 0.4798 0.5276 0.8168 -0.0056 -0.3482 -0.3275 0.1151 0.3650 -0.2092 -0.2390 -0.2777 -0.0560 -0.6278 -0.7292 -0.4220 -0.0829 0.0096 0.3314 -0.3953 0.3601 0.1881 ]
mybuildmodel function [idxz, rz, idxy, ry]=mybuildmodel(z,y) allz=[]; for i=1:size(z,2) allz=[allz z{i}]; end allz=allz'; [idxz, rz]= kmeans(allz,3); rz=rz';
mybuildmodel (2) ally=[]; for i=1:size(y,2) ally=[ally y{i}]; end for i=1:size(y,2) ally=[ally y{i}]; end ally=ally'; [idxy, ry]= kmeans(ally,3); ry=ry';
mycountdist function myclass=mycountdist(idxz, rz, idxy, ry,resultmfccnew) mydistz=0; mydisty=0; for framenya=1:size(resultmfccnew,2) min=1;
mycountdist (2) minjarz=dist([rz(:,1) resultmfccnew(:,framenya)]); for j=2:3 jarz=dist([rz(:,j) resultmfccnew(:,framenya)]); if jarz<=minjarz minjarz=jarz; end mydistz=mydistz+minjarz;
mycountdist (3) minjary=dist([ry(:,1) resultmfccnew(:,framenya)]); for j=2:3 jary=dist([ry(:,j) resultmfccnew(:,framenya)]); if jary<=minjary minjary=jary; end mydisty=mydisty+minjary;
mycountdist (4) disp(‘distance to class z'); disp(mydistz); disp(' distance to class y'); disp(mydisty); if mydistz<=mydisty myclass=1; disp(‘This signal is member of class z'); else myclass=2; disp(' This signal is member of class y'); end
In MATLAB command window [idxz, rz, idxy, ry]=mybuildmodel(z,y) theclass=mycountdist(idxz, rz, idxy, ry,c)