가사 한글화에서 [섹션 태그] 제외 — Suno 구조 인식 보존

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jwkim 2026-08-27 10:24:12 +09:00
parent eb4064279b
commit cb00945612

View File

@ -506,10 +506,18 @@ def _native(n: int) -> str:
def hangulize_numbers(text: str) -> str:
"""가사 속 아라비아 숫자를 전부 한글 발음으로 치환.
"""가사 속 아라비아 숫자를 한글 발음으로 치환 (Suno 전송본 전용).
1승→일승, 78승→칠십팔승, 7게임→일곱 게임, 5:3→오 대 삼, 0.312→영점삼일이.
[Verse 1] 같은 섹션 태그는 Suno 구조 인식용이라 건드리지 않는다.
"""
parts = re.split(r"(\[[^\]]*\])", text)
return "".join(
p if p.startswith("[") else _hangulize_plain(p) for p in parts
)
def _hangulize_plain(text: str) -> str:
# 소수(타율 등): 0.312 → 영점삼일이 (소수부는 자리별 낭독)
text = re.sub(
r"(\d)\.(\d+)",