정답: 가수가 제목 정답에 섞이던 것·틀린 한글 발음 정답 고치기 (docs 13)

- 퀴즈 편집 화면: '추가 정답' 한 칸을 '제목 정답'·'가수 정답' 두 칸으로
- 괄호 안이 그 곡 가수 이름이면 제목 정답이 아님: cleanTitle(title, artist) — Crank That (Soulja Boy), 레이 (LAY). 정답 생성·플레이리스트·파일 읽기 모두 가수를 넘김
- 재생목록으로 엑셀 만들기: 정답·가수 정답 칸에 제목·가수를 다시 적지 않음(다른 표기만)
- 한글 발음 정답은 검수한 표기표(answers/lexicon.json: 단어 2,299·제목 74·가수 이름 1,111, 띄어 쓴 꼴과 붙여 쓴 꼴)만. 표기표에 없는 단어가 있으면 발음 정답 없이 unknownWords → 새 곡은 '확인 필요'(발음 확인 필요: …), 관리자 → 제목 정리에서 제목/가수 정답을 더해 적용. 규칙 읽기(en-ko.ts)는 후보·옛 정답 찾기에만
- cli redo-readings [--dry-run] [--old-lexicon]: 옛 규칙(이나 이전 표기표)이 만든 발음 정답만 빼고 표기표 표기로 — DB 별칭(source auto)과 일반 퀴즈 정답, 관리자 별칭·직접 쓴 정답·이지선다는 그대로. cli lexicon-missing: 표기표에 없는 단어와 규칙 후보
- 멜론 차트: 재생이 막힌 곡은 제목 칸에 링크가 없어 가수 링크를 제목으로 읽던 것 → 제목 칸만 읽음. cli fix-melon-titles: 제목이 가수 이름인 멜론 곡을 곡 정보 페이지 제목으로(자기 이름 곡은 그대로), 같은 곡이 이미 있으면 합침, 잘못 찾은 후보 영상은 원곡 찾기로
- decodeEntities: é·° 등(Céline Dion)
- 가수 칸의 따옴표 안을 with로 자르지 않음('Miki Matsubara Official "stay with me"' → 가수 정답 '미')
- 테스트: 표기표 읽기(사용자가 짚은 10곡 포함), 확인 필요로 보내기·정답 더해 적용, 발음 정답 바꾸기(DB·퀴즈·이지선다 제외·이전 표기표), 멜론 제목 칸·곡명·fix-melon-titles, 가수 괄호, 엑셀 칸; e2e quiz(재생목록 엑셀 칸)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-11-04 20:44:05 +09:00
parent 9a07b9978d
commit b360ff0eb7
24 changed files with 4166 additions and 54 deletions

View File

@@ -191,10 +191,10 @@ test('재생목록으로 엑셀 만들기: kept songs with 비고, unplayable /
expect(sheets.map((x) => x.name)).toEqual(['퀴즈', '빠진 곡']);
expect(sheets[0]!.rows).toEqual([
['순번', '유튜브 영상 링크', '제목', '가수', '정답(;로 구분)', '가수 정답(;로 구분)', '힌트', '시작(초)', '하이라이트(초)', '길이(초)', '비고'],
[1, 'https://youtu.be/goodday0001', '좋은 날', '아이유', '좋은 날; Good Day', '아이유; IU', null, null, null, 230, 'DB 곡'],
[2, 'https://youtu.be/lovedive001', '곡 2', '가수 2', '곡 2', '가수 2', null, null, null, 200, '제목·가수 확인 필요 (영상 제목 형식이 달라 채널 이름을 가수로 씀)'],
[3, 'https://youtu.be/hypeboy0001', '곡 6', '가수 6', '곡 6', '가수 6', null, null, null, 200, '확인 필요: NewJeans - Hype Boy'],
[4, 'https://youtu.be/ditto000001', '곡 7', '가수 7', '곡 7', '가수 7', null, null, null, null, '유튜브 뮤직에서 찾음'],
[1, 'https://youtu.be/goodday0001', '좋은 날', '아이유', 'Good Day', 'IU', null, null, null, 230, 'DB 곡'],
[2, 'https://youtu.be/lovedive001', '곡 2', '가수 2', null, null, null, null, null, 200, '제목·가수 확인 필요 (영상 제목 형식이 달라 채널 이름을 가수로 씀)'],
[3, 'https://youtu.be/hypeboy0001', '곡 6', '가수 6', null, null, null, null, null, 200, '확인 필요: NewJeans - Hype Boy'],
[4, 'https://youtu.be/ditto000001', '곡 7', '가수 7', null, null, null, null, null, null, '유튜브 뮤직에서 찾음'],
]);
expect(sheets[1]!.rows.slice(1)).toEqual([
[3, 'https://youtu.be/blocked0001', '원래 3', '채널', '다른 사이트 재생이 막힌 영상'],

View File

@@ -201,8 +201,8 @@ export function parseQuizRows(rows: string[][], columns: (QuizColumn | null)[],
const own = (start !== null && start !== undefined) || (highlight !== null && highlight !== undefined);
const fromStart = !own && blank === 'start';
const length = parseSec(cell(r, at('duration')));
const clean = cleanTitle(title);
const artist = cell(r, at('desc')).slice(0, 200);
const clean = cleanTitle(title, artist);
const written = splitAnswers(cell(r, at('answers')));
const writtenArtist = splitAnswers(cell(r, at('descAnswers')));
out.push({
@@ -321,8 +321,9 @@ export function playlistSheets(list: PlaylistSheetRow[], kind: QuizKind = 'norma
else
kept.push([
...head,
[r.title, ...(r.titleAnswers ?? []).filter((a) => a !== r.title)].join('; '),
[r.artist, ...(r.artistAnswers ?? []).filter((a) => a !== r.artist)].filter(Boolean).join('; '),
// the title and the artist always count without being written: only the other names (an empty cell is filled on import)
(r.titleAnswers ?? []).filter((a) => a !== r.title).join('; ') || null,
(r.artistAnswers ?? []).filter((a) => a !== r.artist).join('; ') || null,
null,
...tail,
]);

View File

@@ -28,6 +28,13 @@ describe('제목 정리 (docs/13)', () => {
expect(cleanTitle('광(狂)').title).toBe('광');
expect(cleanTitle('미스터 (Mr.)')).toEqual({ title: '미스터', aliases: [] });
});
test("the singer's name in brackets is not another name of the song (Crank That (Soulja Boy))", () => {
expect(cleanTitle('Crank That (Soulja Boy)', 'Soulja Boy')).toEqual({ title: 'Crank That', aliases: [] });
expect(cleanTitle('레이 (LAY)', '레이 (LAY), Alan Walker')).toEqual({ title: '레이', aliases: [] });
expect(cleanTitle('Still D.R.E. (Dr. Dre)', 'Dr. Dre, Snoop Dogg').aliases).toEqual([]);
// another singer's name stays: it is not this song's credit
expect(cleanTitle('사랑을 했다(LOVE SCENARIO)', 'iKON').aliases).toEqual(['LOVE SCENARIO', '사랑을 했다 LOVE SCENARIO']);
});
test('a leading bracket and a part number stay as words', () => {
expect(cleanTitle("(I Can't Help) Falling In Love With You")).toEqual({ title: "I Can't Help Falling In Love With You", aliases: ['Falling In Love With You'] });
expect(shown('Love The Way You Lie (Part II) (Feat. Eminem)')).toBe('Love The Way You Lie Part II');

View File

@@ -5,6 +5,8 @@
* Artist names are left alone ("(여자)아이들", "LE SSERAFIM (르세라핌)").
*/
import { looseKey } from './match-key';
const PAIRS: Record<string, string> = { '(': ')', '[': ']', '{': '}', '【': '】', '「': '」', '『': '』', '(': ')', '[': ']', '〈': '〉', '《': '》' };
const CLOSERS = new Set(Object.values(PAIRS));
@@ -74,8 +76,24 @@ const KANA_HAN = /[\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}]/u;
const HANGUL = /\p{Script=Hangul}/u;
const hangulName = (s: string) => HANGUL.test(s) && !KANA_HAN.test(s) && !/[A-Za-z]/.test(s);
/** Strips brackets, feat. and version marks from a song title; see the file comment. */
export function cleanTitle(raw: string): CleanTitle {
/** Each name in an artist credit ("레이 (LAY), Alan Walker" → 레이 (LAY), 레이, LAY, Alan Walker …) as a loose key. */
export function creditKeys(artist: string): Set<string> {
const out = new Set<string>();
for (const part of [artist, ...artist.split(/\s*(?:,|&|\/|·|\sx\s|\bfeat\.?\s|\bwith\s)\s*/i)]) {
for (const n of [part, part.replace(/\s*[([(][^)\])]*[)\])]/g, ''), ...[...part.matchAll(/[([(]([^)\])]+)[)\])]/g)].map((m) => m[1]!)]) {
const k = looseKey(n);
if (k) out.add(k);
}
}
return out;
}
/**
* Strips brackets, feat. and version marks from a song title; see the file comment. With the song's `artist`, a bracket
* that only names its singer ("Crank That (Soulja Boy)", "레이 (LAY)") is a credit, not another name of the song.
*/
export function cleanTitle(raw: string, artist?: string): CleanTitle {
const credit = artist ? creditKeys(artist) : null;
const src = squash(raw.normalize('NFC'));
let s = src;
const dash = DASH_SUFFIX.exec(s);
@@ -91,7 +109,7 @@ export function cleanTitle(raw: string): CleanTitle {
whole += before;
rest += before;
at = g.end;
if (isTitleNote(g.inner)) {
if (isTitleNote(g.inner) || credit?.has(looseKey(g.inner))) {
shown += ' ';
whole += ' ';
rest += ' ';