0001 function [out, unvoicedPhoneList]=isUnvoicedPhone(phoneName, pinYinType)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 if nargin<1, selfdemo; return; end
0012 if nargin<2, pinYinType='hanyu'; end
0013
0014 fullPath=which(mfilename);
0015 [parentDir, mainName, extName, version]=fileparts(fullPath);
0016 switch lower(pinYinType)
0017 case 'hanyu'
0018 unvoicedPhoneListFile=[parentDir, '\exe\dict\hanyu.qiyin'];
0019 case 'taihua'
0020 unvoicedPhoneListFile=[parentDir, '\exe\dict\taihua.qiyin'];
0021 otherwise
0022 error(['Unknown pinYinType = ', pinYinType]);
0023 end
0024 unvoicedPhoneList=textread(unvoicedPhoneListFile, '%s', 'delimiter', '\n', 'whitespace', '');
0025 out=any(strcmp(unvoicedPhoneList, phoneName));
0026
0027
0028 function selfdemo
0029 phone='sh';
0030 out=feval(mfilename, phone);
0031 fprintf('%s(''%s'')=%d\n', mfilename, phone, out);
0032 phone='a';
0033 out=feval(mfilename, phone);
0034 fprintf('%s(''%s'')=%d\n', mfilename, phone, out);