fix: TTS가 온도 범위(28~35°C)를 자연스럽게 못 읽던 버그 수정

voice.js는 "~"를 기호제거 정규식이 °C보다 먼저 먹어버려 앞쪽 숫자가
단위를 잃었고("28 섭씨 35도"), voice-call.js는 "~" 제거 자체가 없어서
숫자 한글변환 단계까지 물결표가 그대로 살아남았음. 두 파일 다 범위 전용
정규식을 °C/°F 처리보다 먼저 넣어서 "섭씨 28도에서 35도"로 자연스럽게
읽도록 수정.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
kimandClaude Sonnet 5 committed 2026-08-08 19:21:52 +09:00
1 parent 968aab1faa
commit bb8599574b
2 files changed
+13

No files matched your search

+6
View File
@@ -302,6 +302,12 @@ function _cleanForSpeech(text) {
// after the newline-to-comma pause below reads as a rushed, breathless
// run-on (reported 2026-07-10). Must run before \n gets consumed.
.replace(/^\s*[-*+]\s+/gm, '')
// Range temperatures (e.g. "28~35°C") must be caught before the generic
// symbol strip below eats the "~" — otherwise the first number loses its
// unit entirely and reads as a disconnected "28 섭씨 35도" (reported 2026-08-08).
.replace(/(\d+(?:\.\d+)?)\s*~\s*(\d+(?:\.\d+)?)\s*°C/gi, '섭씨 $1도에서 $2도')
.replace(/(\d+(?:\.\d+)?)\s*~\s*(\d+(?:\.\d+)?)\s*°F/gi, '화씨 $1도에서 $2도')
.replace(/(\d+(?:\.\d+)?)\s*~\s*(\d+(?:\.\d+)?)\s*°/g, '$1도에서 $2도')
.replace(/[#*`_~>]/g, ' ')
.replace(/(\d+(?:\.\d+)?)\s*°C/gi, '섭씨 $1도')
.replace(/(\d+(?:\.\d+)?)\s*°F/gi, '화씨 $1도')
+7
View File
@@ -344,6 +344,13 @@
// — the digits (even with a decimal point) come through fine once the
// symbol itself is spelled out in Korean (verified via STT round-trip,
// 2026-07-10). Order matters: °C/°F before the bare ° fallback.
// Range temperatures (e.g. "28~35°C") must be caught first — unlike
// voice.js this file never strips "~" at all, so without this it survives
// untouched into the final digit-spelling pass as a literal tilde
// (reported 2026-08-08).
.replace(/(\d+(?:\.\d+)?)\s*~\s*(\d+(?:\.\d+)?)\s*°C/gi, '섭씨 $1도에서 $2도')
.replace(/(\d+(?:\.\d+)?)\s*~\s*(\d+(?:\.\d+)?)\s*°F/gi, '화씨 $1도에서 $2도')
.replace(/(\d+(?:\.\d+)?)\s*~\s*(\d+(?:\.\d+)?)\s*°/g, '$1도에서 $2도')
.replace(/(\d+(?:\.\d+)?)\s*°C/gi, '섭씨 $1도')
.replace(/(\d+(?:\.\d+)?)\s*°F/gi, '화씨 $1도')
.replace(/(\d+(?:\.\d+)?)\s*°/g, '$1도')