Home > asr > isUnvoicedPhone.m

isUnvoicedPhone

PURPOSE ^

isUnvoicedPhone: Return 1 if the given phone is unvoiced

SYNOPSIS ^

function [out, unvoicedPhoneList]=isUnvoicedPhone(phoneName, pinYinType)

DESCRIPTION ^

 isUnvoicedPhone: Return 1 if the given phone is unvoiced
    Usage: [out, unvoicedPhoneList]=isUnvoicedPhone(phoneName, pinYinType)
        phoneName: Name of the phone
        pinYinType: Type of pinyin, could be 'hanyu', 'taihua', or 'english'
        out: output of the function
        unvoicedPhoneList: List of all unvoiced phones

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [out, unvoicedPhoneList]=isUnvoicedPhone(phoneName, pinYinType)
0002 % isUnvoicedPhone: Return 1 if the given phone is unvoiced
0003 %    Usage: [out, unvoicedPhoneList]=isUnvoicedPhone(phoneName, pinYinType)
0004 %        phoneName: Name of the phone
0005 %        pinYinType: Type of pinyin, could be 'hanyu', 'taihua', or 'english'
0006 %        out: output of the function
0007 %        unvoicedPhoneList: List of all unvoiced phones
0008 
0009 %    Roger Jang, 20080616
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 % ====== Self demo
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);

Generated on Tue 01-Jun-2010 09:50:19 by m2html © 2003