Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

加敎院式 #57

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions gwongzau.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
* @author Ayaka
*/

if (!音韻地位) return [['$legacy', true]];
if (!音韻地位) return [
['精清母', [1, '敎院:dz、ts', '語會:z、c']],
['諸韻', [1, '敎院:y', '語會:yu']],
//['分œɵ', [1, '敎院:不分', '語會:分']],//暫時保留
['入聲調號', [1, '敎院:789', '語會:136']],
];

const is = (x) => 音韻地位.屬於(x);

Expand Down Expand Up @@ -218,13 +223,13 @@ function 聲調規則() {
if (is('平聲')) return '1'; // 陰平
if (is('上聲')) return '2'; // 陰上
if (is('去聲')) return '3'; // 陰去
if (is('入聲')) return '1'; // 陰入。長元音為 3,詳後
if (is('入聲')) return '7'; // 陰入。長元音為8,詳後
} else {
if (is('平聲')) return '4'; // 陽平
if (is('全濁 上聲')) return '6'; // 陽去,全濁上變去
if (is('上聲')) return '5'; // 陽上
if (is('去聲')) return '6'; // 陽去
if (is('入聲')) return '6'; // 陽入
if (is('入聲')) return '9'; // 陽入
}
throw new Error('無聲調規則');
}
Expand All @@ -244,7 +249,7 @@ const is細音 = ['eo', 'i', 'oe', 'u', 'yu'].some((x) => 韻母.startsWith(x));
if (聲母 === 'ng' && is細音) 聲母 = 'j';

// 陰入分化
if (is('入聲') && 聲調 === '1' && is長元音(韻母)) 聲調 = '3';
if (聲調 === '7' && is長元音(韻母)) 聲調 = '8';

if (is('合口 或 模韻') && !['eo', 'oe', 'yu'].some((x) => 韻母.startsWith(x))) { // 合口字
if (聲母 === 'g' && !韻母.startsWith('u')) 聲母 = 'gw';
Expand All @@ -266,4 +271,22 @@ if (is('入聲')) {
else if (韻母.endsWith('ng')) 韻母 = 韻母.slice(0, -2) + 'k';
}

//敎院式
if (選項.精清母 === '敎院:dz、ts') {
if (聲母 === 'z') 聲母 = 'dz';
if (聲母 === 'c') 聲母 = 'ts';
}
if (選項.諸韻 === '敎院:y') {
if (韻母.startsWith('y')) 韻母 = 韻母.replace('u','');
}
//if (選項.分œɵ === '敎院:不分') {//暫時保留
// if (韻母 === 'eoi') 韻母 ='oey';//暫時保留
// if (韻母.startsWith('eo')) 韻母 = 韻母.replace('eo', 'oe');//暫時保留
//}//暫時保留
if (選項.入聲調號 === '語會:136') {
if (聲調 === '7') 聲調 = '1';
if (聲調 === '8') 聲調 = '3';
if (聲調 === '9') 聲調 = '6';
}

return 聲母 + 韻母 + 聲調;