0001 function [initial, final]=hanyu2initialFinal(hanyuSyl)
0002
0003
0004
0005
0006
0007
0008
0009
0010 consonant={'z', 'c', 's', 'zh', 'ch', 'sh', 'k', 'h', 'd', 't', 'b', 'p', 'j', 'q', 'x', 'f', 'g', 'l', 'm', 'n', 'nn', 'r'};
0011 for i=1:length(consonant)
0012 consonantLen(i)=length(consonant{i});
0013 end
0014 [junk, index]=sort(-consonantLen);
0015 consonant=consonant(index);
0016
0017 initial=[];
0018 final=hanyuSyl;
0019 for i=1:length(consonant)
0020 if strfind(hanyuSyl, consonant{i})==1
0021 initial=consonant{i};
0022 final=hanyuSyl(length(consonant{i})+1:end);
0023 break;
0024 end
0025 end