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

老國音 #60

Open
wants to merge 58 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
d24a3fd
Create 老國音.js
307587 Sep 9, 2024
795af1e
Update 老國音.js
307587 Sep 9, 2024
85fd26f
Update 老國音.js
307587 Oct 10, 2024
a8af6cc
Update 老國音.js
307587 Oct 10, 2024
17a4ac6
Update 老國音.js:攝
307587 Oct 18, 2024
90ea890
Update 老國音.js 果攝
307587 Oct 18, 2024
14775c7
Update 老國音.js
307587 Oct 18, 2024
08d7b21
Update 老國音.js
307587 Oct 18, 2024
7fd735d
Update 老國音.js
307587 Oct 18, 2024
83b4b97
Update 老國音.js
307587 Oct 18, 2024
ff53d16
Update 老國音.js
307587 Oct 18, 2024
1af9075
Update 老國音.js
307587 Oct 24, 2024
95f5bfa
Update 老國音.js
307587 Oct 24, 2024
435bba5
Update 老國音.js
307587 Oct 24, 2024
51ec6ce
Update 老國音.js
307587 Oct 24, 2024
68bb61b
Update 老國音.js
307587 Oct 25, 2024
6cebc27
Update 老國音.js
307587 Oct 25, 2024
0e5eafe
Update 老國音.js
307587 Oct 25, 2024
d564db9
Update 老國音.js
307587 Oct 25, 2024
9d9a189
Update 老國音.js
307587 Oct 25, 2024
6f820a0
Update 老國音.js
307587 Oct 25, 2024
d8a4f88
Update 老國音.js
307587 Oct 31, 2024
3a1f6b5
Update 老國音.js
307587 Oct 31, 2024
bd5cb90
Update 老國音.js
307587 Oct 31, 2024
0461471
Update 老國音.js
307587 Oct 31, 2024
43eeef0
Update 老國音.js
307587 Nov 1, 2024
d5edac5
Update 老國音.js
307587 Nov 2, 2024
bad7031
Update 老國音.js
307587 Nov 2, 2024
c317f01
Update 老國音.js
307587 Nov 2, 2024
805c828
Update 老國音.js
307587 Nov 2, 2024
f16c762
Update 老國音.js
307587 Nov 11, 2024
9813ac3
Update 老國音.js
307587 Nov 11, 2024
5128326
Update 老國音.js
307587 Nov 13, 2024
a51de91
Update 老國音.js
307587 Nov 13, 2024
193e906
Update 老國音.js
307587 Nov 13, 2024
2ae7514
Merge branch 'nk2028:main' into 307587-patch-1
307587 Nov 20, 2024
3192e32
Update README.md ONP
307587 Nov 20, 2024
07050b8
Update main.js
307587 Nov 20, 2024
f900ebe
Update main.js
307587 Nov 20, 2024
f35bdb2
Update main.js
307587 Nov 20, 2024
a6abd3f
Update 老國音.js
307587 Nov 20, 2024
ba5696d
Update 老國音.js
307587 Nov 21, 2024
bafd589
Update README.md
307587 Nov 22, 2024
8159b4b
Update test/main.js
307587 Nov 22, 2024
bcced32
Update 老國音.js
307587 Nov 22, 2024
8ef0f9e
Update 老國音.js
307587 Nov 22, 2024
c4e3562
Update 老國音.js
307587 Nov 22, 2024
a2c90c0
Update 老國音.js
307587 Nov 22, 2024
edcc2b5
Update 老國音.js
307587 Nov 22, 2024
9a8c846
Update 老國音.js
307587 Nov 22, 2024
31aa9da
Update 老國音.js
307587 Nov 23, 2024
be665ee
Update 老國音.js
307587 Nov 23, 2024
2cf4143
Update 老國音.js
307587 Nov 23, 2024
c319add
Update 老國音.js
307587 Nov 23, 2024
954f892
Update 老國音.js
307587 Nov 23, 2024
59344f1
Update 老國音.js
307587 Nov 23, 2024
7a24191
Update 老國音.js
307587 Nov 23, 2024
05a3eab
Update 老國音.js
307587 Nov 23, 2024
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ https://nk2028-1305783649.file.myqcloud.com/tshet-uinh-examples/<filename>

**現代方言推導音 extrapolated pronunciations of modern dialects**

- 推導老國音 (Extrapolated Old National Pronunciation): `老國音.js`
307587 marked this conversation as resolved.
Show resolved Hide resolved
- 推導普通話 (Extrapolated Putonghua): `putonghua.js`
- 推導廣州話 (Extrapolated Cantonese): `gwongzau.js`
- 推導上海話 (Extrapolated Shanghainese): `zaonhe.js`
Expand Down
1 change: 1 addition & 0 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const testCases = [
["n_song", "ɕjɛ́w"],
["mongol", "ꡮꡠꡓ"],
["zhongyuan", "ʂjɛw³"],
["老國音", "ㄕㄠˇ"],
307587 marked this conversation as resolved.
Show resolved Hide resolved
//["fanwan", "shiu2"],
["putonghua", "shǎo"],
["gwongzau", "siu2"],
Expand Down
292 changes: 292 additions & 0 deletions 老國音.js
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

隔聲韻調的選項這樣改會令推導器標示方括號有問題;let 隔位那些也可以廢了吧

Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
/* 推導老國音,@author 307587

音系:https://zh.wikiversity.org/zh-hant/%E8%80%81%E5%9C%8B%E9%9F%B3%E9%9F%B3%E7%B4%A0
音變規則:https://zh.wikiversity.org/zh-hant/%E8%80%81%E5%9C%8B%E9%9F%B3%E8%88%87%E5%BB%A3%E9%9F%BB%E5%B0%8D%E6%AF%94
字音來源:https://github.com/baopaau/rime-bepemefeve/blob/main/bepemefeve.dict.yaml
注意「僞老國音」:https://www.bilibili.com/read/cv17377530/
*/
graphemecluster marked this conversation as resolved.
Show resolved Hide resolved

/** @type { 音韻地位['屬於'] } */
const is = (...x) => 音韻地位.屬於(...x);
/** @type { 音韻地位['判斷'] } */
const when = (...x) => 音韻地位.判斷(...x);

if (!音韻地位) return [
['注音符號\n否的話就用國際音標', true],
['喉塞|標示入聲喉塞音韻尾\n啟用「注音符號」時無效', true],
['調式', [8, '調值(趙元任)', '調值(王璞)', '調線(趙元任)', '調線(王璞)', '附標', '調號上標', '調號', '調符']],
307587 marked this conversation as resolved.
Show resolved Hide resolved
['聲調在前\n調式爲「附標」時無效', false],
['隔聲韻調\n調式爲「附標」時只隔聲和韻', [3, '空格', '定位', '無']],
Copy link
Member

@graphemecluster graphemecluster Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
['隔聲韻調\n調式爲「附標」時只隔聲和韻', [3, '空格', '定位', '無']],
[`隔聲韻調
調式爲「附標」時只隔聲和韻`, [3,
{ text: '空格', value: ' ' },
{ text: '定位', value: '\t' },
{ text: '無', value: '' },
]],

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這樣改會令推導器顯示方括號有問題

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這樣改會令推導器顯示方括號有問題

不明白


現在在推導器中傳回陣列結果雖然看起來與直接 concatenate 沒有分別,但實際上是連續的 text nodes
所以我認為可以先傳回陣列,這些選項留待日後加入到複製/匯出設定,見 nk2028/tshet-uinh-autoderiver#54
@syimyuzya 這樣可以嗎

['常母平聲陰聲韻聲母和船母平聲聲母', [2, 'tʂʰ', 'ʂ']],
307587 marked this conversation as resolved.
Show resolved Hide resolved
['介母|介母寫成半元音而非元音\n元音:iuy\n半元音:jwɥ\n啟用「注音符號」時無效', false],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我覺得除了介音,韻尾也要有這個選項
而且最好有多個候選,譬如説 ['i u', 'i̯ u̯', 'ɪ ʊ', 'ɪ̯ ʊ̯', 'j w', 'j̞ w̞']
但好像又太多,不知道 @untunt 怎麼看?預設選項用那個好?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
['介母|介母寫成半元音而非元音\n元音:iuy\n半元音:jwɥ\n啟用「注音符號」時無效', false],
['介母', [1,
{ text: '元音:i u y', value: '元音' },
{ text: '半元音:j w ɥ', value: '半元音' },
], { hidden: 選項.注音符號 === true }],

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

写这种接近现代汉语的音系,韵尾要么只提供 i、u(一般学界习惯),要么只提供 ɪ、ʊ(我的习惯),就够了。提供这两个以外的选择就属于华而不实了。所以韵尾就保持方案现状就好

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

介母選項這樣寫不就長多了?維持一行不行嗎?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

還有,我覺得介音寫法保留核取方塊好些,這與特殊演變那些二元選擇不同,這看來可以是是非題而特殊演變不像。

['見泰合|見組泰合韻韻母\nuai、uəi兩者勢均,\n但疑泰合只有「外」且讀uai', [2, 'uai', 'uəi']],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我覺得往後所有方案選項應該用模版字串,如:

Suggested change
['見泰合|見組泰合韻韻母\nuai、uəi兩者勢均,\n但疑泰合只有「外」且讀uai', [2, 'uai', 'uəi']],
[`見泰合|見組泰合韻韻母
uai、uəi兩者勢均,
但疑泰合只有「外」且讀uai`, [2, 'uai', 'uəi']],

現在這樣 \nuai 實在是太難看了。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

徵求 @syimyuzya @untunt 的意見

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好主意!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

現在這樣\nuai實在是太難看了。

['見佳合|牙喉音佳合韻韻母\n預測uai,但有不少ua', [2, 'ua', 'uai']],
['幫幽|幫滂並母幽韻韻母\n多讀iəu,只在幫滂並母讀iau,如「彪」', [2, 'iau', 'iəu']],
['莊侵入|莊組侵韻入聲韻母\n生母侵韻入聲多讀əʔ,如「澀」,\n但莊組其餘多脫翹並讀iʔ', [2, 'ʅʔ', 'əʔ']],
['知莊真合入|知莊組真合韻入聲韻母\nuʔ、uoʔ兩者勢均,徹莊母多uʔ', [2, 'uʔ', 'uoʔ']],
['莊臻入|莊組臻韻入聲韻母\nəʔ、ʅʔ兩者勢均', [2, 'əʔ', 'ʅʔ']],
['見文入|見組文韻入聲韻母\n預測yʔ(如「屈」,溪文入)但見羣疑母多yeʔ', [2, 'yeʔ', 'yʔ']],
['見梗二開舒|牙喉音梗二開舒韻母\n見開二通常顎化,但梗攝不規則,如見母不顎化', [2, 'iŋ', 'əŋ']],
['匣上|匣上變去\n匣母上聲有很多字不變去聲', true],
];

const 聲母規則 = () => when([
['幫滂並母 C類', 'f'],
['幫母 或 並母 仄聲', 'p'],
['滂並母', 'pʰ'],
['明母', [['微韻', 'ʋ'], ['C類 非 流通攝', ''], ['', 'm']]],

['端母 或 定母 仄聲', 't'],
['透定母', 'tʰ'],
['泥孃母', 'n'],
['來母', 'l'],

['精母 或 從母 仄聲', 'ts'],
['清從母', 'tsʰ'],
['心邪母', 's'],

['知莊章母 或 澄崇母 仄聲', 'tʂ'],
['徹澄初崇昌母', 'tʂʰ'],
['生俟書船母', 'ʂ'],
['常母', [['平聲 陽聲韻', 'tʂʰ'], ['', 'ʂ']]],
['日母', [['止攝 開口', ''], ['', 'ɻ']]],

['見母 或 羣母 仄聲', 'k'],
['溪羣母', 'kʰ'],
['疑母', 'ŋ'], //細音詳後

['影云以母', ''],
['曉匣母', 'x'],
], '無聲母規則');

const 舒聲韻母規則 = () => when([
//果攝
['歌韻 一等', [['合口 非 疑母', 'uo'], ['', 'o']]],
['歌韻 三等', [['脣音', 'uo'], ['合口', 'ye'], ['', 'ie']]], //輕脣?

//假攝
['麻韻 二等', [['合口', 'ua'], ['牙喉音', 'ia'], ['', 'a']]],
['麻韻 三四等', 'ie'],

//遇攝
['模韻', 'u'],
['魚虞韻', 'y'],

//蟹攝
['咍灰泰韻', [['開口', 'ai'], ['泰韻 合口 疑母', 'uai'], ['', 'uəi']]], //泰合韻見組uai、uəi兩者勢均
['佳皆夬韻', [['合口', 'uai'], ['牙喉音', 'iai'], ['', 'ai']]], //佳合韻牙喉音應爲/uai/,但有不少/ua/
['祭廢齊韻', [['廢韻 脣音', 'uəi'], ['廢韻 開口 銳音', 'iai'], ['合口', 'uəi'], ['', 'i']]], //明廢去無字;銳廢開「茝ㄔㄞˇ佁䑂𦚪」

//止攝
['止攝 合口', [['莊組', 'uai'], ['', 'uəi']]],
['止攝', [['精組', 'ɿ'], ['日母', 'ɚ'], ['', 'i']]],

//效攝
['宵蕭韻 或 肴韻 牙喉音', 'iau'],
['豪肴韻', 'au'],

//流攝
['侯韻', 'əu'],
['尤韻', [['脣音', 'əu'], ['', 'iəu']]],
['幽韻', [['幫滂並母', 'iau'], ['', 'iəu']]],

//咸攝
['鹽添韻 或 咸銜嚴韻 牙喉音', 'ian'],
['覃談咸銜嚴韻', 'an'],
['凡韻', 'yan'],

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

//山攝
['寒刪山韻 合口', 'uan'],
['刪山韻 牙喉音', 'ian'],
['寒刪山韻', 'an'],
['仙先韻', [['合口', 'yan'], ['', 'ian']]],
['元韻', [['開口', 'ian'], ['', 'yan']]],

//臻攝
['痕韻', 'ən'],
['魂韻', 'uən'],
['真臻殷韻', [['合口', 'yn'], ['', 'in']]], //臻韻莊組會推如ən,詳後
['文韻', 'yn'],

//梗攝
['梗攝 二等', [['合口', 'uŋ'], ['', 'əŋ']]],
['梗攝', [['合口', 'yŋ'], ['', 'iŋ']]],

//曾攝
['登韻', [['合口', 'uŋ'], ['', 'əŋ']]],
['蒸韻', [['合口', 'yŋ'], ['', 'iŋ']]], //蒸合韻無舒聲但照推

//宕攝
['唐韻', [['合口', 'uaŋ'], ['', 'aŋ']]],
['陽韻', [['合口 或 幫莊組', 'uaŋ'], ['', 'iaŋ']]],

//江攝
['江韻', [['牙喉音', 'iaŋ'], ['知莊組', 'uaŋ'], ['', 'aŋ']]],

//通攝
['通攝', [['三等 牙喉音', 'yŋ'], ['', 'uŋ']]],
], '無韻母規則');

const 入聲韻母規則 = () => when([
//咸攝
['覃談韻', [['牙喉音', 'oʔ'], ['', 'aʔ']]],
['咸銜韻', [['牙喉音', 'iaʔ'], ['', 'aʔ']]],
['嚴鹽添韻', 'ieʔ'],
['凡韻', [['脣音', 'uaʔ'], ['', 'yeʔ']]], //明凡入無字

//深攝
['侵韻', [['莊組', 'əʔ'], ['', 'iʔ']]],

//山攝
['寒韻', [['合口', 'uoʔ'], ['脣牙喉音', 'oʔ'], ['', 'aʔ']]],
['刪山韻', [['合口', 'uaʔ'], ['牙喉音', 'iaʔ'], ['', 'aʔ']]],
['仙先韻', [['合口', 'yeʔ'], ['', 'ieʔ']]],
['元韻', [['脣音', 'uaʔ'], ['合口', 'yeʔ'], ['', 'ieʔ']]],

//臻攝
['痕韻', 'əʔ'],
['魂韻', [['脣音', 'oʔ'], ['', 'uʔ']]],
['真韻 合口', [['知莊組', 'uoʔ'], ['', 'yʔ']]], //知莊組uʔ、uoʔ兩者勢均,徹莊母多uʔ
['真臻殷韻', 'iʔ'], //莊組臻韻難決定取əʔ還是ʅʔ
['文韻', 'yʔ'], //見組文韻入聲讀音預測yʔ(如「屈ㄑㄩ˙」,溪文入)但見羣疑母多yeʔ

//梗攝
['梗攝 二等', [['合口', 'uoʔ'], ['', 'əʔ']]],
['梗攝', [['合口', 'yʔ'], ['', 'iʔ']]],

//曾攝
['登韻', [['合口', 'uoʔ'], ['', 'əʔ']]],
['蒸韻', [['合口', 'yʔ'], ['莊組', 'əʔ'], ['', 'iʔ']]],

//宕攝
['唐韻', [['合口', 'uoʔ'], ['', 'oʔ']]],
['陽韻', [['合口 或 幫莊組', 'yoʔ'], ['', 'ioʔ']]], //明陽入無字;孃陽入無常用字;莊組開口oʔ、uoʔ兩者勢均,但對應陽聲韻今讀合口呼

//江攝
['江韻', [['牙喉音', 'ioʔ'], ['知莊組', 'uoʔ'], ['', 'oʔ']]],

//通攝
['通攝', [['三等 牙喉音', 'yʔ'], ['', 'uʔ']]],
], '無韻母規則');

const 聲調規則 = () => when([
['平聲', [['清音', '1'], ['濁音', '2']]],
['去聲 或 上聲 全濁', '4'],
['上聲', '3'],
['入聲', '5'],
], '無聲調規則');

let 聲母 = 聲母規則();
let 韻母 = is`舒聲` ? 舒聲韻母規則() : 入聲韻母規則();
let 聲調 = 聲調規則();

if (選項.常母平聲陰聲韻聲母和船母平聲聲母 && is`(常母 陰聲韻 或 船母) 平聲`) 聲母 = 選項.常母平聲陰聲韻聲母和船母平聲聲母;
if (選項.見泰合 && is`見溪羣母 泰韻 合口`) 韻母 = 選項.見泰合;
if (選項.見佳合 && is`見影匣母 佳韻 合口`) 韻母 = 選項.見佳合;
if (選項.幫幽 && is`幫滂並母 幽韻`) 韻母 = 選項.幫幽;
if (選項.莊侵入 && is`莊組 侵韻 入聲`) 韻母 = 選項.莊侵入;
if (選項.知莊真合入 && is`知莊組 真韻 合口 入聲`) 韻母 = 選項.知莊真合入;
if (選項.莊臻入 && is`莊組 臻韻 入聲`) 韻母 = 選項.莊臻入;
if (選項.見文入 && is`見羣疑母 文韻 入聲`) 韻母 = 選項.見文入;
if (選項.見梗二開舒 && is`溪疑影曉匣母 梗攝 二等 開口 舒聲`) 韻母 = 選項.見梗二開舒;
if (選項.匣上 === false && is`匣母 上聲`) 聲調 = '3';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我覺得這些應該盡量內嵌到上面


//顎化;疑母齊、撮呼不規則脫鼻
if (['i', 'y'].includes(韻母[0])) 聲母 = {
k: 'tɕ', kʰ: 'tɕʰ', x: 'ɕ',
}[聲母] || 聲母;
if (['i', 'y'].includes(韻母[0]) && 聲母 === 'n' && !is`齊之韻 開口`) 聲母 = 'ɲ';
if (韻母[0] === 'i' && 聲母 === 'ŋ') {
if (is`(齊之尤蒸陽韻 非 合口) 或 (侵仙先元庚韻 入聲)`) 聲母 = 'ɲ'; //要不要括著?
else 聲母 = '';
}
307587 marked this conversation as resolved.
Show resolved Hide resolved
if (韻母[0] === 'y' && 聲母 === 'ŋ') 聲母 = '';

//捲舌音
if (['tʂ', 'tʂʰ', 'ʂ', 'ɻ'].includes(聲母)) {
if (['i', 'iʔ'].includes(韻母)) 韻母 = 'ʅ' + 韻母.slice(1);
if (['in', 'iŋ'].includes(韻母)) 韻母 = 'ə' + 韻母.slice(1);
if (韻母[0] === 'i' && 韻母[1]) 韻母 = 韻母.slice(1);
if (韻母 === 'yeʔ') 韻母 = 'uoʔ';
if (韻母[0] === 'y') 韻母 = 'u' + 韻母.slice(1); //un→uən,詳後
}

//脣音
if (is`脣音` && 韻母[0] === 'y') 韻母 = 'u' + 韻母.slice(1); //un→uən,詳後
if (韻母 === 'un') 韻母 = 'uən'; //一次過un→uən
if (['p', 'pʰ', 'm', 'f'].includes(聲母) && 韻母[0] === 'u' && 韻母[1] && !['n', 'ŋ', 'ʔ'].includes(韻母[1])) 韻母 = 韻母.slice(1);
if (['f', 'ʋ'].includes(聲母) && 韻母[0] === 'i') 韻母 = 韻母.slice(1) || 'əi';

//疑母
if (聲母 === 'ŋ' && 韻母[0] === 'u') 聲母 = '';

if (選項.介母 === true && 選項.注音符號 === false && !聲母) {
if (韻母[0] === 'i') 聲母 = 'j';
if (韻母[0] === 'u') 聲母 = 'w';
if (韻母[0] === 'y') 聲母 = 'ɥ';
if (聲母 && 韻母[1] && !['n', 'ŋ', 'ʔ'].includes(韻母[1])) 韻母 = 韻母.slice(1);
}

if (選項.喉塞 === false && 選項.注音符號 === false && is`入聲`) 韻母 = 韻母.slice(0, -1);

if (選項.注音符號 === true) {
聲母 = {
p: 'ㄅ', pʰ: 'ㄆ', m: 'ㄇ', f: 'ㄈ', ʋ: 'ㄪ',
t: 'ㄉ', tʰ: 'ㄊ', n: 'ㄋ', l: 'ㄌ',
k: 'ㄍ', kʰ: 'ㄎ', ŋ: 'ㄫ', x: 'ㄏ',
tɕ: 'ㄐ', tɕʰ: 'ㄑ', ɲ: 'ㄬ', ɕ: 'ㄒ',
tʂ: 'ㄓ', tʂʰ: 'ㄔ', ʂ: 'ㄕ', ɻ: 'ㄖ',
ts: 'ㄗ', tsʰ: 'ㄘ', s: 'ㄙ',
}[聲母] || 聲母;
韻母 = {
i: 'ㄧ', u: 'ㄨ', y: 'ㄩ',
a: 'ㄚ', o: 'ㄛ', ə: 'ㄜ', ɚ: 'ㄦ', e: 'ㄝ',
ai: 'ㄞ', əi: 'ㄟ', au: 'ㄠ', əu: 'ㄡ',
an: 'ㄢ', ən: 'ㄣ', aŋ: 'ㄤ', əŋ: 'ㄥ',
ia: 'ㄧㄚ', ie: 'ㄧㄝ',
iai: 'ㄧㄞ', iau: 'ㄧㄠ', iəu: 'ㄧㄡ',
ian: 'ㄧㄢ', in: 'ㄧㄣ', iaŋ: 'ㄧㄤ', iŋ: 'ㄧㄥ',
ua: 'ㄨㄚ', uo: 'ㄨㄛ', uai: 'ㄨㄞ', uəi: 'ㄨㄟ',
uan: 'ㄨㄢ', uən: 'ㄨㄣ', uaŋ: 'ㄨㄤ', uŋ: 'ㄨㄥ',
yo: 'ㄩㄛ', ye: 'ㄩㄝ', yan: 'ㄩㄢ', yn: 'ㄩㄣ', yŋ: 'ㄩㄥ',
iʔ: 'ㄧ', uʔ: 'ㄨ', yʔ: 'ㄩ',
aʔ: 'ㄚ', iaʔ: 'ㄧㄚ', uaʔ: 'ㄨㄚ',
oʔ: 'ㄛ', ioʔ: 'ㄧㄛ', uoʔ: 'ㄨㄛ', yoʔ: 'ㄩㄛ',
əʔ: 'ㄜ', eʔ: 'ㄝ', ieʔ: 'ㄧㄝ', yeʔ: 'ㄩㄝ',
}[韻母] || 韻母;
if (['ɿ', 'ʅ'].includes(韻母[0])) 韻母 = '';
}

let 隔位 = 選項.隔聲韻調;
if (選項.隔聲韻調 === '無') 隔位 = '';
if (選項.隔聲韻調 === '空格') 隔位 = ' ';
if (選項.隔聲韻調 === '定位') 隔位 = '\t';

if (選項.調式 === '調值(趙元任)') 聲調 = {
1: '⁵⁵', 2: '³⁵', 3: '²¹⁴', 4: '⁵¹', 5: '⁵',
}[聲調] || 聲調;
if (選項.調式 === '調值(王璞)') 聲調 = {
1: '⁴⁴', 2: '³⁵⁵', 3: '²¹⁴', 4: '⁴¹', 5: '⁴¹',
}[聲調] || 聲調;
if (選項.調式 === '調線(趙元任)') 聲調 = {
1: '˥', 2: '˧˥', 3: '˨˩˦', 4: '˥˩', 5: '˥', //字元數眞對稱w
graphemecluster marked this conversation as resolved.
Show resolved Hide resolved
}[聲調] || 聲調;
if (選項.調式 === '調線(王璞)') 聲調 = {
1: '˦', 2: '˧˥˥', 3: '˨˩˦', 4: '˦˩', 5: '˦˩',
}[聲調] || 聲調;
if (選項.調式 === '調符') 聲調 = {
1: 'ˉ', 2: 'ˊ', 3: 'ˇ', 4: 'ˋ', 5: '˙',
}[聲調] || 聲調;
if (選項.調式 === '調號上標') 聲調 = {
1: '¹', 2: '²', 3: '³', 4: '⁴', 5: '⁵',
}[聲調] || 聲調;

if (選項.調式 !== '附標') {
if (選項.聲調在前 === true) return 聲調 + 隔位 + 聲母 + 隔位 + 韻母;
else return 聲母 + 隔位 + 韻母 + 隔位 + 聲調;
}
if (選項.調式 === '附標' && is`入聲`) return 聲母 + 隔位 + 韻母;
return 聲母 + 隔位 + (聲調 ? 韻母.replace(/.*[aoəe]|.*[iɿʅuy]/, '$&' + ' ̄́̌̀'[聲調]) : 韻母);
307587 marked this conversation as resolved.
Show resolved Hide resolved