fix(melo-test): strip standalone Hangul jamo before synthesis

MeloTTS-Korean's symbol vocab only includes precomposed Hangul
syllables. Bare Hangul Compatibility Jamo characters (ㅋㅋㅋ, ㅠㅠ, ㅎㅎ)
and Hangul Jamo block code points blow up in
`cleaned_text_to_sequence` with `KeyError: 'ㅋ'` (or similar).

Pre-clean the request text in `/tts` to drop those code point ranges
before handing the string to the model, collapsing the leftover
whitespace. If sanitization yields an empty string, return 400 with
an explanation instead of a 500 stack trace.

Also document the limitation in the README troubleshooting section.
This commit is contained in:
Claude Owner
2026-05-26 21:04:27 +09:00
parent 106915b55b
commit 6211985730
2 changed files with 31 additions and 3 deletions

View File

@@ -114,6 +114,11 @@ Content-Type: application/json
한국어 발음이 깨짐
→ 입력에 영문/이모지가 섞이면 운율이 어색해질 수 있음. 디스코드 봇 통합 단계에서 `TTSClient.textReplace` 같은 사전 치환을 그대로 활용.
`KeyError: 'ㅋ'` (또는 'ㅠ', 'ㅎ' 등)
→ MeloTTS-Korean 의 symbol vocab 은 완성형 음절(가, 나, ...)만 포함하므로 'ㅋㅋㅋ', 'ㅠㅠ' 같은 한글 자모(Hangul Compatibility Jamo) 가 단독으로 들어오면 합성 단계에서 죽음.
`server.py` 가 요청 직전에 단독 자모를 자동으로 제거하므로 최신 코드(`git pull`) 받으면 해결.
봇 통합 단계에서도 어댑터에서 같은 sanitize 를 적용할 것.
`RuntimeError: Failed initializing MeCab` / `no such file or directory: ...\unidic\dicdir\mecabrc`
`unidic` 사전 데이터 미다운로드. 가상환경 활성화 상태에서 `python -m unidic download` 실행 후 재시작.
한국어만 써도 MeloTTS 가 임포트 시점에 일본어 모듈을 강제 로딩하기 때문에 이 단계는 필수.