Skip to content

Commit

Permalink
Update n_song: eŋ > iˤŋ
Browse files Browse the repository at this point in the history
  • Loading branch information
untunt committed Nov 2, 2024
1 parent c0d2c4d commit 159d3ae
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions n_song.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,18 @@ function get聲調() {
}[選項.聲調 ?? '附加符號']['平上去入'.indexOf(聲調)];
}

function 音位to音值(音節) {
function 底層to表層(音節) {
function 替換韻核(from, tos, condition = true) {
if (!condition) return;
音節.韻核 = 音節.韻核.replace(from, 音節.介音.includes('w') ? tos.pop() : tos[0]);
}

const is曾梗攝 = ['ŋ', 'k'].includes(音節.韻尾);
替換韻核('a', ['ɑ']); // 先把 /a/ 重置成一等的音值 [ɑ]
替換韻核('a', ['ɑ']); // 先把 /a/ 重置成一等的表層形式 [ɑ]
if (音節.介音.includes('ʕ')) {
// 二等
替換韻核('ɯ', ['ɯ', 'u']);
替換韻核('ɨ', ['e'], is曾梗攝);
替換韻核('ɨ', [''], is曾梗攝);
替換韻核('ɨ', ['ɨ', 'u'], 音節.韻尾);
替換韻核('ɑ', ['a']);
} else if (音節.介音.includes('j')) {
Expand Down Expand Up @@ -247,10 +247,12 @@ function get音節() {
韻尾: 韻基.substring(1),
聲調: get聲調(),
};
if (is表層) 音位to音值(音節);
if (is表層) 底層to表層(音節);
後處理(音節);
音節.韻母 = 音節.介音 + 音節.韻核 + 音節.韻尾;
音節.帶調韻母 = 音節.介音 + 音節.韻核 + (選項.聲調 === '調類數字' ? 音節.韻尾 + 音節.聲調 : 音節.聲調 + 音節.韻尾);
if (選項.聲調 === '調類數字') 音節.帶調韻母 = 音節.韻母 + 音節.聲調;
else if (音節.韻核.length === 1) 音節.帶調韻母 = 音節.介音 + 音節.韻核 + 音節.聲調 + 音節.韻尾;
else 音節.帶調韻母 = 音節.介音 + 音節.韻核[0] + 音節.聲調 + 音節.韻核.slice(1) + 音節.韻尾;
return 音節;
}

Expand Down

0 comments on commit 159d3ae

Please sign in to comment.