Skip to content

リモートTTSへは「Keisei」の読み替えを適用せず原文のまま送るよう端末内蔵TTS限定に変更 - #6872

Merged
TinyKitten merged 1 commit into
devfrom
claude/keiseibus-english-reading-bug-q4db4b
Sep 6, 2026
Merged

TinyKitten merged 1 commit into
devfrom
claude/keiseibus-english-reading-bug-q4db4b

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Sep 6, 2026 •

Copy link
Copy Markdown
Member

概要

#6869 で入れた「Keisei → Kay-say」の読み替えを、端末内蔵 TTS(expo-speech)の経路に限定します。リモート TTS(Google Cloud TTS)の経路では同じ置換を TrainLCD/functions 側(TrainLCD/Functions#25)の normalizeRomanText が合成前に行うため、アプリからは原文の「Keisei」のまま送り、サーバー側の正規化とキャッシュキーを単一の入力に揃えます。

変更の種類

  • バグ修正
  • 新機能
  • リファクタリング
  • ドキュメント
  • CI/CD
  • その他

変更内容

  • src/utils/speakableText.ts: toSpeakableText に第 3 引数 engine: 'native' | 'remote' を追加。英語文の固有名詞読み替え(fixEnglishReading)は native のときだけ適用し、remote では日本語文字の除去までで止めて原文の表記のまま返す
    • 「JR → J-R」の置換は従来どおり両経路で適用します(サーバー側は 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):

npm run lint      -> Checked 721 files. No fixes applied.
npm test -- src/utils/speakableText.test.ts src/utils/englishReading.test.ts src/hooks/tts src/hooks/useTTS.test.ts
                  -> Test Suites: 7 passed, Tests: 120 passed
npm run typecheck -> エラーなし

関連Issue

スクリーンショット(任意)

UI 変更なし: src/utils/** と src/hooks/tts/** の読み上げテキスト生成ロジックのみの変更で、画面表示には変化がありません

🤖 Generated with Claude Code

https://claude.ai/code/session_01WS1LSBnYTMfm7CyrzqKxuW


Generated by Claude Code

Summary by CodeRabbit

  • 改善
    • 音声エンジンに応じて、読み上げテキストを適切に変換するよう改善しました。
    • 端末内蔵の音声では、英語の固有名詞を発音しやすい表記に補正します。
    • リモート音声では、英語の固有名詞を原文のまま維持し、意図しない読み替えを防ぎます。
    • 日本語の除去、SSML、読み上げ範囲など、既存の読み上げ動作は維持されています。

@TinyKitten TinyKitten self-assigned this Sep 6, 2026
@github-actions github-actions Bot added the react label Sep 6, 2026
@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: b4458faa-fe99-41a3-8372-624450c8977b

📥 Commits

Reviewing files that changed from the base of the PR and between 30f927c and 67b278a.

📒 Files selected for processing (4)
  • src/hooks/tts/useNativeSpeechEngine.ts
  • src/hooks/tts/useRemoteSpeechEngine.ts
  • src/utils/speakableText.test.ts
  • src/utils/speakableText.ts

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.


📝 Walkthrough

Walkthrough

toSpeakableText に音声エンジン種別を追加しました。ネイティブ音声では英語の読み補正を適用し、リモートTTSでは原文を維持します。各TTS呼び出し元とテストにモード指定を追加しました。

Changes

音声エンジン別変換

Layer / File(s) Summary
変換契約とテスト
src/utils/speakableText.ts, src/utils/speakableText.test.ts
toSpeakableText が native または remote を受け取ります。英語固有名詞の補正をネイティブ音声に限定し、両モードの結果をテストします。
TTS呼び出しへのモード指定
src/hooks/tts/useNativeSpeechEngine.ts, src/hooks/tts/useRemoteSpeechEngine.ts
ネイティブ音声には native、リモートTTSには remote を指定します。

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 67b27

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

うさぎは声の道を跳ね
native には読みを添え
remote には原文を渡す
JR は J-R と響き
テストの月を見上げる
耳を澄ませて、完了

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed タイトルは、リモートTTSでは「Keisei」の読み替えを行わず、端末内蔵TTSに限定する主要変更を明確に示しています。
Description check ✅ Passed 概要、変更内容、変更の種類、テスト結果、関連Issue、UI変更なしの説明を含んでいます。テンプレートの必須項目を満たし、変更目的と検証結果も具体的です。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/keiseibus-english-reading-bug-q4db4b

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants