From 4acc24796c3b56be0d21d91dd99838c5f9b6b772 Mon Sep 17 00:00:00 2001 From: kim Date: Tue, 20 Oct 2026 16:29:03 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=8C=EC=84=B1=20=EB=82=AD=EB=8F=85=20?= =?UTF-8?q?=EB=B3=B4=EC=A0=95:=20=EB=82=A0=EC=A7=9C=C2=B7=EC=8B=9C?= =?UTF-8?q?=EA=B0=81(3:30=E2=86=92=EC=84=B8=EC=8B=9C=20=EC=82=BC=EC=8B=AD?= =?UTF-8?q?=EB=B6=84)=C2=B7=EB=B9=84=EC=9C=A8,=20=ED=91=9C=20=EB=8B=A8?= =?UTF-8?q?=EC=9C=84=20=EC=97=B4(=C2=B0C/%/mm),=20$1,200=20=EC=89=BC?= =?UTF-8?q?=ED=91=9C=20=EC=88=9C=EC=84=9C,=2024=EC=8B=9C=20=EA=B3=A0?= =?UTF-8?q?=EC=9C=A0=EC=96=B4=20=EC=8B=9C=EA=B0=81;=20=F0=9F=94=8A=20?= =?UTF-8?q?=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EB=B2=84=ED=8A=BC=EC=9D=B4=20?= =?UTF-8?q?=ED=86=B5=ED=99=94=EC=99=80=20=EA=B0=99=EC=9D=80=20=EA=B7=9C?= =?UTF-8?q?=EC=B9=99=EC=9D=84=20=EC=93=B0=EB=8F=84=EB=A1=9D=20=ED=86=B5?= =?UTF-8?q?=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- web-ui/js/app/voice.js | 3 +++ web-ui/js/voice/voice-call.js | 25 +++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/web-ui/js/app/voice.js b/web-ui/js/app/voice.js index b21e872..74ee68a 100644 --- a/web-ui/js/app/voice.js +++ b/web-ui/js/app/voice.js @@ -158,6 +158,7 @@ function _splitForSpeech(text) { var start = 0; for (var i = 0; i < text.length; i++) { if (text[i] === '.' && /\d/.test(text[i - 1] || '') && /\d/.test(text[i + 1] || '')) continue; // decimal point, not a boundary + if (text[i] === '.' && /[A-Za-z0-9]/.test(text[i - 1] || '') && /[A-Za-z]/.test(text[i + 1] || '')) continue; // domain dot (investing.com), not a boundary if (/[.!?\n]/.test(text[i])) { var j = i + 1; while (j < text.length && /[\s.!?]/.test(text[j])) j++; @@ -288,6 +289,8 @@ function _hourReplacer(m, numStr, suffix) { // bare "°C"/"°F" gets read as "그램"(grams) instead of degrees. function _cleanForSpeech(text) { if (typeof window !== 'undefined' && window.SpeechTables) text = window.SpeechTables.narrateTablesInText(text || ''); // 표 → 문장(speech-tables.js) + // 통화 낭독과 같은 규칙(날짜·시각·범위·도메인·쉼표 숫자·월 읽기 등)을 쓴다 — 두 벌로 갈라져 한쪽만 고쳐지던 문제(2026-10-20) + if (typeof window !== 'undefined' && typeof window.sanitizeForSpeech === 'function') return window.sanitizeForSpeech(text || ''); text = (typeof window !== 'undefined' && window.spellUnitsForSpeech) ? window.spellUnitsForSpeech(text || '') : (text || ''); // g/kg/GB/Hz… 단위 낭독(speech-units.js) return (text || '') .replace(/!\[.*?\]\(.*?\)/g, '') diff --git a/web-ui/js/voice/voice-call.js b/web-ui/js/voice/voice-call.js index 7063aa1..a4fde3f 100644 --- a/web-ui/js/voice/voice-call.js +++ b/web-ui/js/voice/voice-call.js @@ -449,7 +449,7 @@ // (일/이/삼...), specifically for clock hours and hour-durations — "9시" // is "아홉 시", never "구시" (reported 2026-07-10). Everything else (분, // 초, 도, %, dates, etc.) correctly stays Sino-Korean via _numToHangulWord. - const _NATIVE_HOUR = { 1: '한', 2: '두', 3: '세', 4: '네', 5: '다섯', 6: '여섯', 7: '일곱', 8: '여덟', 9: '아홉', 10: '열', 11: '열한', 12: '열두' }; + const _NATIVE_HOUR = { 1: '한', 2: '두', 3: '세', 4: '네', 5: '다섯', 6: '여섯', 7: '일곱', 8: '여덟', 9: '아홉', 10: '열', 11: '열한', 12: '열두', 13: '열세', 14: '열네', 15: '열다섯', 16: '열여섯', 17: '열일곱', 18: '열여덟', 19: '열아홉', 20: '스무', 21: '스물한', 22: '스물두', 23: '스물세', 24: '스물네' }; function _hourReplacer(m, numStr, suffix) { const n = parseInt(numStr, 10); return _NATIVE_HOUR[n] ? _NATIVE_HOUR[n] + suffix : m; @@ -469,11 +469,17 @@ } function sanitizeForSpeech(text) { + // 천 단위 쉼표(9,500 / 1,234,567)는 숫자 낭독 전에 제거한다. 안 그러면 "9"와 "500"이 따로 읽혀 + // "9,500원"이 "구, 오백원"이 되어 "천"이 통째로 사라진다(09-26 "단어가 한번씩 빠진다", 표의 가격 열). + // 단위 낭독보다 먼저여야 "$1,200"이 "1달러,200"으로 쪼개지지 않는다. + text = String(text || '').replace(/(?<=\d),(?=\d{3}(?!\d))/g, ''); text = window.spellUnitsForSpeech ? window.spellUnitsForSpeech(text) : text; // g/kg/GB/Hz… 단위 낭독(speech-units.js) return text - // 천 단위 쉼표(9,500 / 1,234,567)는 숫자 낭독 전에 제거한다. 안 그러면 "9"와 "500"이 따로 읽혀 - // "9,500원"이 "구, 오백원"이 되어 "천"이 통째로 사라진다(09-26 "단어가 한번씩 빠진다", 표의 가격 열). - .replace(/(?<=\d),(?=\d{3}(?!\d))/g, '') + // 날짜 2026-10-19 / 2026.10.19 / 2026/10/19 → "2026년 10월 19일"(안 그러면 마이너스·점으로 읽힌다). 월은 아래에서 시월·유월 처리. + .replace(/(? `${y}년 ${parseInt(mo, 10)}월 ${parseInt(d, 10)}일`) + // 시각 3:30 / 05:10 → "3시 30분"(정각이면 "3시"). 분이 한 자리인 3:1 같은 건 비율/점수로 "3 대 1". + .replace(/(? (+h <= 24 && +mi < 60) ? `${parseInt(h, 10)}시${+mi ? ' ' + parseInt(mi, 10) + '분' : ''}` : m) + .replace(/(?