Skip to content

JR山手線でTTS文言改良#5375

Merged
TinyKitten merged 1 commit intodevfrom
feature/jy-tts
Feb 20, 2026
Merged

JR山手線でTTS文言改良#5375
TinyKitten merged 1 commit intodevfrom
feature/jy-tts

Conversation

@TinyKitten
Copy link
Member

@TinyKitten TinyKitten commented Feb 20, 2026

Summary by CodeRabbit

  • 改善
    • 山手線の列車種別情報の表示精度が向上しました。日本語および英語の案内テキストがより正確に生成されるようになります。

@TinyKitten TinyKitten self-assigned this Feb 20, 2026
@github-actions github-actions bot added the react label Feb 20, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

📝 Walkthrough

ウォークスルー

useTTSText フックに対して、山手線向けの列車種別ラベル生成ロジックを追加し、TTS テンプレート内で currentTrainType の使用箇所を新しい山手線専用ラベルに置き換えるとともに、日本語・英語の両方向に対応したフォールバック処理を実装しました。

変更内容

コホート / ファイル(s) 概要
山手線TTS テンプレートロジック更新
src/hooks/useTTSText.ts
山手線判定(isYamanoteLine)と方向情報(selectedDirection)を追加して、Yamanote 専用列車種別ラベル(日本語・英語)を新規導出。複数のテンプレート内で currentTrainType → 山手線ラベル → '各駅停車'/'Local' のフォールバック順序で条件分岐を実装。メモ化依存関係も更新。

推定コードレビュー工数

🎯 3 (Moderate) | ⏱️ ~20分

関連する可能性のあるPR

推奨ラベル

react

🐰 山手線の列車が呼ぶ、
新しい言葉で ひかり輝く
テンプレートは優雅に分岐し
日本語も英語も 心地よく唱える
列車アナウンス より美しく 🚃✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルはJR山手線のTTS文言改良という具体的で明確な変更内容を示しており、raw_summaryで説明されている山手線固有の列車種別ラベルの追加や改良という主要な変更内容と完全に関連しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/jy-tts

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/hooks/useTTSText.ts (1)

121-130: 一貫性のためyamanoteTrainTypeEnもメモ化を検討してください。

yamanoteTrainTypeJauseMemoでメモ化されていますが、yamanoteTrainTypeEnは通常の変数として定義されています。プリミティブ値を返すため機能的な問題はありませんが、コードの一貫性のため同様にメモ化することを推奨します。

♻️ 提案する修正
-  const yamanoteTrainTypeEn = isYamanoteLine ? 'Yamanote Line' : null;
+  const yamanoteTrainTypeEn = useMemo(
+    () => (isYamanoteLine ? 'Yamanote Line' : null),
+    [isYamanoteLine]
+  );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/hooks/useTTSText.ts` around lines 121 - 130, Wrap the yamanoteTrainTypeEn
computation in useMemo for consistency with yamanoteTrainTypeJa: replace the
plain const yamanoteTrainTypeEn = isYamanoteLine ? 'Yamanote Line' : null with a
useMemo that depends on isYamanoteLine (e.g., useMemo(() => isYamanoteLine ?
'Yamanote Line' : null, [isYamanoteLine])) so both yamanoteTrainTypeJa and
yamanoteTrainTypeEn are memoized similarly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/hooks/useTTSText.ts`:
- Around line 121-130: Wrap the yamanoteTrainTypeEn computation in useMemo for
consistency with yamanoteTrainTypeJa: replace the plain const
yamanoteTrainTypeEn = isYamanoteLine ? 'Yamanote Line' : null with a useMemo
that depends on isYamanoteLine (e.g., useMemo(() => isYamanoteLine ? 'Yamanote
Line' : null, [isYamanoteLine])) so both yamanoteTrainTypeJa and
yamanoteTrainTypeEn are memoized similarly.

@TinyKitten TinyKitten merged commit 9bca01a into dev Feb 20, 2026
7 checks passed
@TinyKitten TinyKitten deleted the feature/jy-tts branch February 20, 2026 10:13
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.

1 participant