From 7385ae4b72608c4abacbc486980d1e2de9ee29f6 Mon Sep 17 00:00:00 2001 From: EJClaw Date: Wed, 4 Nov 2026 16:21:49 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A0=95=EB=8B=B5=20=EC=9E=90=EB=8F=99=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1:=20=ED=95=9C=EA=B5=AD=EC=96=B4=20=EC=A0=9C?= =?UTF-8?q?=EB=AA=A9=EC=97=90=20=ED=95=9C=EC=9E=90=20=EB=B3=84=EC=B9=AD?= =?UTF-8?q?=EC=9D=B4=20=EB=B6=99=EC=9D=80=20=EA=B3=A1(=EB=AA=BD(=E5=A4=A2)?= =?UTF-8?q?)=EC=9D=84=20=EC=9D=BC=EB=B3=B8=EC=96=B4=20=EC=A0=9C=EB=AA=A9?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=B4=EA=B3=A0=20=EC=9C=84=ED=82=A4?= =?UTF-8?q?=EB=B0=B1=EA=B3=BC=20=EC=9D=B4=EB=A6=84(=EA=BF=88)=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B0=94=EA=BE=B8=EB=8D=98=20=EA=B2=83=20=E2=80=94?= =?UTF-8?q?=20=EA=B4=84=ED=98=B8=20=EB=B0=96=20=EC=9B=90=EC=A0=9C=EA=B0=80?= =?UTF-8?q?=20=EC=9D=BC=EB=B3=B8=EC=96=B4=EC=9D=BC=20=EB=95=8C=EB=A7=8C=20?= =?UTF-8?q?=EC=9D=BC=EB=B3=B8=EC=96=B4=20=EC=A0=9C=EB=AA=A9=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=8B=A4=EB=A3=B8.=20=ED=9A=8C=EA=B7=80=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8(=EA=B3=A0=EC=B9=98=EA=B8=B0=20?= =?UTF-8?q?=EC=A0=84=20=EC=8B=A4=ED=8C=A8=20=ED=99=95=EC=9D=B8),=20?= =?UTF-8?q?=E5=A4=9C=E3=81=AB=E9=A7=86=E3=81=91=E3=82=8B=20(=EB=B0=A4?= =?UTF-8?q?=EC=97=90=20=EB=8B=AC=EB=A6=AC=EB=8B=A4)=20=E2=86=92=20?= =?UTF-8?q?=EB=B0=A4=EC=9D=84=20=EB=8B=AC=EB=A6=AC=EB=8B=A4=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=9C=A0=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- apps/server/src/answers/answers.test.ts | 8 ++++++++ apps/server/src/answers/index.ts | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/server/src/answers/answers.test.ts b/apps/server/src/answers/answers.test.ts index a296d9e..0badb70 100644 --- a/apps/server/src/answers/answers.test.ts +++ b/apps/server/src/answers/answers.test.ts @@ -154,3 +154,11 @@ test('플레이리스트 가져오기: the answers come from the title as found expect(job.rows[1]!.title).toBe('밤을 달리다'); expect(job.rows[1]!.titleAnswers).toEqual(expect.arrayContaining(['夜に駆ける', '요루니 카케루', '요루니 가케루'])); }); + +test('a Korean title with a 한자 alias ("몽(夢)") is never renamed, even when Wikipedia knows the 한자', async () => { + const wiki = async (names: string[]) => new Map(names.includes('夢') ? [['夢', '꿈']] : []); + const [a] = await songAnswersBatch(null, [{ title: '몽(夢)', artist: '가수' }], { korean: true, wiki }); + expect(a).toMatchObject({ title: '몽', note: null }); + expect(a!.titleAnswers).toContain('夢'); + expect(a!.titleAnswers).not.toContain('꿈'); +}); diff --git a/apps/server/src/answers/index.ts b/apps/server/src/answers/index.ts index 779a697..b0badbe 100644 --- a/apps/server/src/answers/index.ts +++ b/apps/server/src/answers/index.ts @@ -114,7 +114,9 @@ export async function songAnswersBatch(db: Database | null, songs: { title: stri }; // the Japanese title: shown as is, or already swapped for its bracket's Korean name by cleanTitle // ("夜に駆ける (밤에 달리다)") — Wikipedia still goes first, so the order is decided on the original - const jaTitle = hasJapanese(c.title) ? c.title : c.aliases.find((a) => hasJapanese(a)); + // only when the title outside the brackets was Japanese: "몽(夢)" is a Korean title with a 한자 alias, never renamed + const outsideJa = hasJapanese(s.title.replace(/[([{([【「『][^)\]})]】」』]*[)\]})]】」』]/g, ' ')); + const jaTitle = hasJapanese(c.title) ? c.title : outsideJa ? c.aliases.find((a) => hasJapanese(a)) : undefined; if (opts.korean && jaTitle) { const bracket = hasJapanese(c.title) ? c.aliases.find((a) => HANGUL.test(a) && !hasJapanese(a)) : c.title; title = korean(jaTitle, bracket, extraTitle);