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
Changes from 1 commit
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
107 changes: 53 additions & 54 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
@@ -1,10 +1,11 @@
/* 推導老國音,@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/
*/

@author 307587 */

/** @type { 音韻地位['屬於'] } */
const is = (...x) => 音韻地位.屬於(...x);
Expand All @@ -13,23 +14,21 @@ const when = (...x) => 音韻地位.判斷(...x);

if (!音韻地位) return [
['注音符號\n否的話就用國際音標', true],
['ㄬㄭ|ㄬ、ㄭ音標\n啟用「注音符號」時無效', [2, 'ȵ、ɿ、ʅ', 'ɲ、ɹ̩、ɻ̍']],
307587 marked this conversation as resolved.
Show resolved Hide resolved
['介母', [1,
{ text: '元音:i u y', value: '元音' },
{ text: '半元音:j w ɥ', value: '半元音' },
], { hidden: 選項.注音符號 === true }],
307587 marked this conversation as resolved.
Show resolved Hide resolved
['ㄚ|ㄚ元音\nㄧㄞ:寬式/iai/、嚴式[iæi]\nㄧ、ㄩ後的ㄢ:寬式/-an/、嚴式[-ɛn]', [2, '嚴式', '寬式']],
307587 marked this conversation as resolved.
Show resolved Hide resolved
['ㄨㄣ|舌冠聲母後的ㄨㄣ讀音\n趙元任《國音新詩韻》:「ㄨㄣ」也可以一律照樣拼念作「ㄨㄜㄋ」,但是在「ㄉ,ㄊ,ㄋ,ㄌ;ㄗ,ㄘ,ㄙ」七個聲母後頭可以省去「ㄜ」音念「ㄨㄋ」', [2, 'un', 'uən']],
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趙元任《國音新詩韻》:「ㄨㄣ」也可以一律照樣拼念作「ㄨㄜㄋ」,但是在「ㄉ,ㄊ,ㄋ,ㄌ;ㄗ,ㄘ,ㄙ」七個聲母後頭可以省去「ㄜ」音念「ㄨㄋ」', [2, 'un', 'uən']],
['ㄨㄣ|\n趙元任《國音新詩韻》:「ㄨㄣ」也可以一律照樣拼念作「ㄨㄜㄋ」,但是在「ㄉ,ㄊ,ㄋ,ㄌ;ㄗ,ㄘ,ㄙ」七個聲母後頭可以省去「ㄜ」音念「ㄨㄋ」', [2, 'un', 'uən'], { hidden: 選項.注音符號 !== false }],

[un] vs [uən] 是对这个韵母记音处理的区别,不是为了表示不同声母后的区别,所以这个选项应当对所有声母都适用

['喉塞|標示入聲喉塞音韻尾', true, { hidden: 選項.注音符號 !== false }],
['調式', ['調符',
'調值(趙元任)', '調值(王璞)', '調線(趙元任)', '調線(王璞)',
...(選項.注音符號 === false ? ['附標'] : []), '調號上標', '調號', '調符',
]],
['聲調在前\n調式爲「附標」時無效', false],
['隔聲韻調
調式爲「附標」時只隔聲和韻', [3,
{ text: '空格', value: ' ' },
{ text: '定位', value: '\t' },
{ text: '無', value: '' },
]],
['隔聲韻調|隔聲韻調\n調式爲「附標」時只隔聲和韻', ''], //待加?留空則爲跳格:(選項.隔聲韻調 || '\t')
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
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.

是爲進階用戶而設,將推導結果貼到試算表可以直接分開聲韻調統計

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
Member

Choose a reason for hiding this comment

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

看這個 comment
#60 (comment)

['常母平聲陰聲韻聲母和船母平聲聲母', [2, 'tʂʰ', 'ʂ']],
307587 marked this conversation as resolved.
Show resolved Hide resolved
['介母', [1,
{ text: '元音:i u y', value: '元音' },
{ text: '半元音:j w ɥ', value: '半元音' },
], { hidden: 選項.注音符號 === true }],
['見泰合|見組泰合韻韻母\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']],
Expand Down Expand Up @@ -231,62 +230,62 @@ 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 && 韻母 === 'uən' && ['t', 'tʰ', 'n', 'l', 'ts', 'tsʰ', 's'].includes(聲母)) 韻母 = 選項.ㄨㄣ; //ㄨㄣ元音
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
if (選項.注音符號 !== true && 韻母 === 'uən' && ['t', 'tʰ', 'n', 'l', 'ts', 'tsʰ', 's'].includes(聲母)) 韻母 = 選項.ㄨㄣ; //ㄨㄣ元音
if (選項.注音符號 !== true && 韻母 === 'uən') 韻母 = 選項.ㄨㄣ; //ㄨㄣ元音

同上面评论


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 (選項.喉塞 === false && 選項.注音符號 === false && is`入聲`) 韻母 = 韻母.slice(0, -1); //喉塞音韻尾

if (選項.調式 === '附標' && 選項.注音符號 === false) {
return 聲母 + 隔位 + (is`舒聲` && 聲調 ? 韻母.replace(/.*[aoəe]|.*[iɿʅuy]/, '$&' + ' ̄́̌̀'[聲調]) : 韻母);
}
if (選項.注音符號 === true) 聲母 = {
p: 'ㄅ', pʰ: 'ㄆ', m: 'ㄇ', f: 'ㄈ', ʋ: 'ㄪ',
t: 'ㄉ', tʰ: 'ㄊ', n: 'ㄋ', l: 'ㄌ',
k: 'ㄍ', kʰ: 'ㄎ', ŋ: 'ㄫ', x: 'ㄏ',
tɕ: 'ㄐ', tɕʰ: 'ㄑ', ɲ: 'ㄬ', ɕ: 'ㄒ',
tʂ: 'ㄓ', tʂʰ: 'ㄔ', ʂ: 'ㄕ', ɻ: 'ㄖ',
ts: 'ㄗ', tsʰ: 'ㄘ', s: 'ㄙ',
}[聲母] || 聲母;
if (選項.注音符號 === true) 韻母 = {
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 (選項.注音符號 === true && ['ɿ', 'ʅ'].includes(韻母[0])) 韻母 = '';

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

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

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