Skip to content

useTTSText の英語アナウンスで transferLines 末尾ピリオドの単複不整合を修正 - #5919

Merged
TinyKitten merged 1 commit into
devfrom
fix/tts-en-transfer-lines-period
May 10, 2026
Merged

TinyKitten merged 1 commit into
devfrom
fix/tts-en-transfer-lines-period

Conversation

@TinyKitten

@TinyKitten TinyKitten commented May 10, 2026 •

Copy link
Copy Markdown
Member

概要

useTTSText の英語テンプレートで、乗り換え路線リスト (transferLines) 末尾ピリオドの付与ルールがテーマごと・件数ごとに揃っていなかった (#5914) ので length=1 でも末尾 . を付けて複数件と整合させた。あわせて JR_KYUSHU ARRIVING では文中ピリオド (Marunouchi Line. at Shinjuku-sanchome.) を廃止し、Marunouchi Line at Shinjuku-sanchome. に統一した (英語として at の前にピリオドは不要なため)。

変更の種類

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

変更内容

  • src/hooks/tts/templates.ts:
    • YAMANOTE_EN.NEXT / SAIKYO_EN.NEXT: {#if hasMultipleTransferLines}.{/if} を素のピリオドに置換。length=1 でも末尾 . が付くようになり、複数件と整合。
    • JR_KYUSHU_EN.ARRIVING: transferLinesEnList 直後のピリオド分岐を完全に削除。length>=2 で起きていた ... Line. at Shinjuku-sanchome. のような文中ピリオドを解消し、単複ともに ... Line at Shinjuku-sanchome. に統一。
  • src/hooks/tts/formatters.ts: formatLinesListEn のコメントから「単数のときだけピリオドを落とす挙動 (※既知の不整合 useTTSText: 英語アナウンスの transferLines 末尾ピリオドが単複で不統一 #5914)」の記述を削除。
  • src/hooks/useTTSText.ts: テンプレート側で使われなくなった hasMultipleTransferLines context キーを削除。
  • src/hooks/useTTSText.test.tsx: length=1 transferLines で各テーマ (TOKYO_METRO / TY / YAMANOTE / SAIKYO / JR_WEST / TOEI / JR_KYUSHU) の NEXT/ARRIVING を検証する describe ブロック (14 件) を追加。次駅 (Shinjuku-sanchome) の lines から東京メトロ副都心線を除外して transferLines を 1 件に絞り、英語 SSML の末尾ピリオドを検証。

テスト

  • npm run lint が通ること
  • npm test が通ること
  • npm run typecheck が通ること

ローカル実行ログ:

  • npx cross-env TZ=UTC jest: 152 suites / 1488 tests pass (新規 14 件含む)
  • npm run typecheck: pass
  • npm run lint: pass (Windows ローカルでは既存 CRLF/LF 警告 20 件あり。base ブランチと同数で、本 PR の変更とは無関係)

関連Issue

Closes #5914

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

Summary by CodeRabbit

リリースノート

  • 改善
    • 英語版の乗り換え路線に関するTTSアナウンスの表現を統一し、一貫性を向上させました。

Review Change Stack

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

coderabbitai Bot commented May 10, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

英語TTS出力の乗り換え路線リスト末尾ピリオド付与ルールをテーマ・件数間で統一するため、hasMultipleTransferLinesコンテキストフラグを削除し、3つのテンプレートを簡略化してテスト カバレッジを追加。

Changes

単数乗り換え路線ピリオド統一

Layer / File(s) Summary
TemplateContextフラグ削除
src/hooks/useTTSText.ts
useTTSText内のTemplateContextからhasMultipleTransferLinesフラグを削除。
TTS テンプレート簡略化
src/hooks/tts/templates.ts
YAMANOTE_EN.NEXT、SAIKYO_EN.NEXT、JR_KYUSHU_EN.ARRIVINGで、hasMultipleTransferLinesの条件分岐を削除し、hasTransferLinesがtrueの場合に常に末尾ピリオド付きの単一形式を使用。
ドキュメンテーション更新
src/hooks/tts/formatters.ts
formatLinesListEn内で「単数時ピリオド省略」の挙動説明コメントを削除。
テストスイート追加
src/hooks/useTTSText.test.tsx
単数乗り換え路線でのピリオド一貫性を検証する新しいテストスイートを追加。複数テーマでSSML形式と末尾ピリオドの正確性を確認。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 一つの路線、一つのピリオド
複数でも単数でも、句点は揃いて
英語の音声、ついに統一
テーマごとの不整合も、今は消えぬ
ふわふわテストで、安心確認~

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed タイトルは PR の主な変更内容(英語アナウンスの transferLines 末尾ピリオドの単複不整合修正)を正確に表しており、明確で簡潔です。
Description check ✅ Passed PR 説明は提供されたテンプレートのほぼすべての必須セクション(概要、変更の種類、変更内容、テスト結果、関連 Issue)を含み、詳細かつ構造化されています。
Linked Issues check ✅ Passed PR は #5914 の要件をすべて満たしており、単数ケース(length=1)での末尾ピリオド付与、複数件との整合、JR_KYUSHU の文中ピリオド削除、コメント削除、テスト追加が実装されています。
Out of Scope Changes check ✅ Passed すべての変更が #5914 の要件と直接関連しており、transferLines 末尾ピリオドの不整合修正とテスト追加という明確なスコープ内で実施されています。
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
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/tts-en-transfer-lines-period

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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.test.tsx (1)

552-552: ⚡ Quick win

テスト名を期待値に合わせると誤読を防げます。

Line 552 の名前は「without trailing period」ですが、期待値は ...Shinjuku-sanchome. で末尾ピリオドありです。名称だけ合わせると意図が伝わりやすくなります。

差分案
-  test('JR_KYUSHU NEXT renders list inline without trailing period for length=1', () => {
+  test('JR_KYUSHU NEXT renders list inline with trailing period for length=1', () => {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/hooks/useTTSText.test.tsx` at line 552, Rename the test titled "JR_KYUSHU
NEXT renders list inline without trailing period for length=1" to reflect the
expected output that includes a trailing period (e.g., mention "with trailing
period"), so the test name matches the expectation checked in the assertion;
locate the test declaration in useTTSText.test.tsx (the test(...) call with that
exact title) and update its string to clearly state the presence of the trailing
period.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/hooks/useTTSText.test.tsx`:
- Line 552: Rename the test titled "JR_KYUSHU NEXT renders list inline without
trailing period for length=1" to reflect the expected output that includes a
trailing period (e.g., mention "with trailing period"), so the test name matches
the expectation checked in the assertion; locate the test declaration in
useTTSText.test.tsx (the test(...) call with that exact title) and update its
string to clearly state the presence of the trailing period.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d6349006-e10d-41cc-9e85-c402ad159b6e

📥 Commits

Reviewing files that changed from the base of the PR and between 0647150 and ebd76d6.

📒 Files selected for processing (4)
  • src/hooks/tts/formatters.ts
  • src/hooks/tts/templates.ts
  • src/hooks/useTTSText.test.tsx
  • src/hooks/useTTSText.ts
💤 Files with no reviewable changes (2)
  • src/hooks/tts/formatters.ts
  • src/hooks/useTTSText.ts

@TinyKitten
TinyKitten merged commit b8a6090 into dev May 10, 2026
6 checks passed
@TinyKitten
TinyKitten deleted the fix/tts-en-transfer-lines-period branch May 10, 2026 23:51
This was referenced May 11, 2026
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.

useTTSText: 英語アナウンスの transferLines 末尾ピリオドが単複で不統一

1 participant