Skip to content

Commit

Permalink
Use 攝 & 等 for deriving modern dialects (#76)
Browse files Browse the repository at this point in the history
Resolves #73 & fixes #75

Other improvements on `putonghua` (35 音韻地位s affected):

- 雄 is now _xióng_ (previously _yóng_)
- 茝 is now _chǎi_ (previously _chǐ_)
- 銳 is now _ruì_ (previously same as 衛)
- 佳韻開口牙喉音 is _ie_ by default
  - (Temporary solution) _ai_ for 影溪母, _ia_ for 疑母 by default
- (Temporary solution) 尤韻脣音 (excluding 明母) is _u_ by default
  - 明母尤韻 is derived as 侯韻 (result same as before)
- 幽韻明母 is _miu_ (previously _miao_)
- 梗攝莊組三等入聲 is derived as _-e_ (previously _-i_)

(There are several places left for further improvements (chiefly regarding some minor cases and the 白讀 system), annotated with TODO and FIXME)

Other improvements on `gwongzau` (1 音韻地位 affected):
- 雄 is now _hung4_ (previously _jung4_)

Other improvements on `ayaka_v8` (28 音韻地位s affected):
- 四つ仮名 is now handled correctly
  • Loading branch information
syimyuzya authored Dec 5, 2024
1 parent 8045c03 commit cdd9e9d
Show file tree
Hide file tree
Showing 3 changed files with 284 additions and 327 deletions.
285 changes: 122 additions & 163 deletions ayaka_v8.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,199 +137,160 @@ function 聲母規則() {

function 韻母規則() {
return when([
// 通攝
['東韻 一等', 'ong'],
['東韻 三四等', [
['幫滂並母', [['舒聲', 'ong'], ['入聲', 'uk']]],
['明母', 'ong'],
['精莊章組', 'yung'],
['舌齒音', [['舒聲', 'yung'], ['入聲', 'ik']]],
['牙喉音', [
['舒聲', 'yung'],
['入聲 影母', 'wik'],
['入聲', 'ik']
['通攝', [
['一等', 'ong'],
['東韻', [
['脣音', [['幫滂並母 入聲', 'uk'], ['', 'ong']]],
['精莊章組', 'yung'],
['', [
['舒聲', 'yung'],
['入聲 影母', 'wik'],
['入聲', 'ik']
]],
]],
['鍾韻', [
['脣音', 'ong'],
['', 'yong'],
]],
]],
['冬韻', 'ong'],
['鍾韻', [
['脣音', 'ong'],
['', 'yong'],
]],

// 江攝
['江韻', 'ang'],

// 止攝
['止攝', [
['脣音', 'i'],
['開口', 'i'],
['合口', [
['舌齒音', 'ui'],
['牙喉音', 'wi'],
]],
['', 'i'],
]],

// 遇攝
['魚韻', [
['莊組', 'o'],
['舌齒音', 'yo'],
['牙喉音', 'yo'],
]],
['虞韻', [
['脣音', 'u'],
['來母', 'u'],
['知組', 'yuu'],
['莊組', 'u'],
['舌齒音', 'yu'],
['以母', 'yu'],
['牙喉音', 'u'],
]],
['模韻', [
['脣音', 'o'],
['舌齒音', 'o'],
['影母', 'wo'],
['牙喉音', 'o'],
['遇攝', [
['魚韻', [
['莊組', 'o'],
['', 'yo'],
]],
['虞韻', [
['鈍音 或 莊組 或 來母', 'u'],
['知組', 'yuu'],
['', 'yu'],
]],
['一等', [
['影母', 'wo'],
['', 'o'],
]],
]],

// 蟹攝
['祭齊韻', [
['脣音', 'ei'],
['開口', 'ei'],
['合口', 'wei'],
]],
['蟹攝 一二等', [
['脣音', 'ai'],
['開口', 'ai'],
['合口', 'wai'],
]],
['廢韻', [
['平上聲 章組', 'ai'],
['脣音', 'ei'],
['開口', 'ei'],
['合口', 'wai'],
['蟹攝', [
['三四等', [
['廢韻 平上聲 章組', 'ai'],
['廢韻 合口', 'wai'],
['合口', 'wei'],
['', 'ei'],
]],
['一二等', [
['合口', 'wai'],
['', 'ai'],
]],
]],

// 臻攝
['真韻', [
['脣音', 'in'],
['開口', 'in'],
['合口', [
['來母', 'in'],
['莊組', [['舒聲', 'on'], ['', 'it']]],
['舌齒音', [['舒聲', 'yun'], ['', 'ot']]],
['云母', 'win'],
['牙喉音', 'in'],
['臻攝', [
['三四等', [
['文韻', 'un'],
['合口', [
['莊組', [['舒聲', 'on'], ['', 'it']]],
['舌齒音 非 來母', [['舒聲', 'yun'], ['', 'ot']]],
['云母', 'win'],
['', 'in'],
]],
['', 'in'],
]],
]],
['臻韻', 'in'],
['文韻', 'un'],
['殷韻', 'in'],
['魂痕韻', 'on'],

// 山攝
['山攝 三四等', [
['脣音 C類', 'an'],
['脣音', 'en'],
['開口', 'en'],
['合口', 'wen'],
]],
['山攝 一二等', [
['脣音', 'an'],
['開口', 'an'],
['合口', 'wan'],
['一等', 'on'],
]],

// 效攝
['蕭宵韻', 'eu'],
['肴韻', 'au'],
['豪韻', [
['脣音', 'ou'],
['舌齒音', 'au'],
['牙喉音', 'au'],
['山攝', [
['一二等 或 脣音 C類', [
['合口', 'wan'],
['', 'an'],
]],
['三四等', [
['合口', 'wen'],
['', 'en'],
]],
]],

// 果攝、假攝
['果假攝 一二等', [
['脣音', 'a'],
['開口', 'a'],
['合口', 'wa'],
]],
['歌韻 三四等', [
['脣音', 'a'],
['開口', 'ya'],
['合口', 'wa'],
]],
['麻韻 三四等', [
['脣音', 'ya'],
['開口', 'ya'],
['合口', 'wa'],
['效攝', [
['三四等', 'eu'],
['二等', 'au'],
['一等', [
['脣音', 'ou'],
['', 'au'],
]],
]],

// 宕攝
['陽韻', [
['脣音', 'ang'],
['開口', [
['莊組', 'ang'],
['舌齒音', 'yang'],
['牙喉音', 'yang'],
['果假攝', [
['一二等 或 脣音 C類', [
['合口', 'wa'],
['', 'a'],
]],
['合口', [
['舌齒音', 'ang'],
['影云母', 'wang'],
['牙喉音', 'wyang'],
['三四等', [
['合口', 'wa'],
['', 'ya'],
]],
]],
['唐韻', [
['脣音', 'ang'],
['開口', 'ang'],
['合口', 'wang'],
]],

// 梗攝
['梗攝 二等', [
['脣音', 'ang'],
['開口', 'ang'],
['合口', 'wang'],
['宕江攝', [
['三四等', [
['合口', [
['舌齒音', 'ang'],
['影云母', 'wang'],
['牙喉音', 'wyang'],
]],
['幫莊組', 'ang'],
['', 'yang'],
]],
['一二等', [
['合口', 'wang'],
['', 'ang'],
]],
]],
['梗攝 三四等', [
['脣音', 'eng'],
['開口', 'eng'],
['合口', 'weng'],

['梗攝', [
['三四等', [
['合口', 'weng'],
['', 'eng'],
]],
['二等', [
['合口', 'wang'],
['', 'ang'],
]],
]],

// 曾攝
['蒸韻', [
['脣音', 'yong'],
['開口', [
['曾攝', [
['三四等', [
['合口', [
['牙音 或 曉匣母', 'wyong'],
['', 'yong'],
]],
['莊組', 'ong'],
['舌齒音', 'yong'],
['牙喉音', 'yong'],
]],
['合口', [
['影云母', 'yong'],
['牙喉音', 'wyong'],
['', 'yong'],
]],
['一等', 'ong'],
]],
['登韻', 'ong'],

// 流攝
['尤韻', [
['幫滂並母', 'uu'],
['明母', 'ou'],
['莊組', 'uu'],
['舌齒音', 'iu'],
['牙喉音', 'iu'],

['流攝', [
['三四等', [
['脣音 AB類', 'iu'],
['明母', 'ou'],
['幫莊組', 'uu'],
['', 'iu'],
]],
['一等', 'ou'],
]],
['侯韻', 'ou'],
['幽韻', 'iu'],

// 深攝
['侵韻', 'im'],
['深攝', 'im'],

// 咸攝
['覃談韻', 'am'],
['鹽添嚴韻', 'em'],
['咸銜凡韻', 'am'],
['咸攝', [
['一二等 或 脣音 C類', 'am'],
['三四等', 'em'],
]],
], '無韻母規則');
}

Expand Down Expand Up @@ -416,7 +377,8 @@ if (選項.音變 === '現代日語') {
if (韻母.endsWith('au')) 韻母 = 韻母.slice(0, -2) + 'ou'; // 高 kau -> kou
else if (韻母.endsWith('iu')) 韻母 = 韻母.slice(0, -2) + 'yuu'; // 宙 tiu -> tyuu
else if (韻母.endsWith('eu')) 韻母 = 韻母.slice(0, -2) + 'you'; // 遙 eu -> you
else if (韻母.endsWith('ang')) 韻母 = 韻母.slice(0, -3) + 'ong'; // 相 syang -> syong

if (聲母 === 'd' && /^[iy]/.test(韻母)) 聲母 = 'z'; // 膩 di -> zi, 紐 dyuu -> zyuu
}

let 聲韻;
Expand Down Expand Up @@ -445,9 +407,6 @@ if (['平假名', '片假名'].includes(選項.書寫系統)) {
else if (聲母 === 'z' && 韻母.startsWith('y')) { 聲母 = 'j'; 韻母 = 韻母.slice(1); } // 繞 zyou -> jou
else if (聲母 === 't' && 韻母.startsWith('y')) { 聲母 = 'ch'; 韻母 = 韻母.slice(1); } // 兆 tyou -> chou

if (聲母 === 'd' && 韻母.startsWith('i')) 聲母 = 'j'; // 膩 di -> ji
else if (聲母 === 'd' && 韻母.startsWith('y')) { 聲母 = 'j'; 韻母 = 韻母.slice(1); } // 紐 dyuu -> juu

if (韻母.endsWith('tu')) 韻母 = 韻母.slice(0, -1) + 'su'; // 遏 atu -> atsu
}
}
Expand Down
Loading

0 comments on commit cdd9e9d

Please sign in to comment.