リモートTTSへは「Keisei」の読み替えを適用せず原文のまま送るよう端末内蔵TTS限定に変更 - #6872
Conversation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WS1LSBnYTMfm7CyrzqKxuW
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (4)
Included review availability: 2 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. 📝 WalkthroughWalkthrough
Changes音声エンジン別変換
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Native speech retains the Keisei pronunciation adjustment, while remote speech receives the original Keisei text; JR handling remains unchanged. The affected conversion paths are covered and ready to merge. Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
概要
#6869 で入れた「Keisei → Kay-say」の読み替えを、端末内蔵 TTS(expo-speech)の経路に限定します。リモート TTS(Google Cloud TTS)の経路では同じ置換を TrainLCD/functions 側(TrainLCD/Functions#25)の
normalizeRomanTextが合成前に行うため、アプリからは原文の「Keisei」のまま送り、サーバー側の正規化とキャッシュキーを単一の入力に揃えます。変更の種類
変更内容
src/utils/speakableText.ts:toSpeakableTextに第 3 引数engine: 'native' | 'remote'を追加。英語文の固有名詞読み替え(fixEnglishReading)はnativeのときだけ適用し、remoteでは日本語文字の除去までで止めて原文の表記のまま返すJ-Rを素通しする前提で実装済みのため)src/hooks/tts/useNativeSpeechEngine.ts:toSpeakableText(..., 'native')を渡すsrc/hooks/tts/useRemoteSpeechEngine.ts:toSpeakableText(..., 'remote')を渡すsrc/utils/speakableText.test.ts: 既存ケースにengineを明示し、リモート向けでは「Keisei」が置換されないこと・JR は置換されることのテストを追加補足
テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ることローカル実行結果(Node 24.20.0 / npm 11.19.0):
関連Issue
スクリーンショット(任意)
UI 変更なし:
src/utils/**とsrc/hooks/tts/**の読み上げテキスト生成ロジックのみの変更で、画面表示には変化がありません🤖 Generated with Claude Code
https://claude.ai/code/session_01WS1LSBnYTMfm7CyrzqKxuW
Generated by Claude Code
Summary by CodeRabbit