Skip to content

英語TTSでMineを「マイン」と読む誤読を端末内蔵TTS向けの読み替え表に追加して修正 - #7015

Merged
TinyKitten merged 1 commit into
devfrom
fix/english-tts-mine-reading
Sep 22, 2026
Merged

TinyKitten merged 1 commit into
devfrom
fix/english-tts-mine-reading

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

概要

英語 TTS が「Mine(美祢・峰など)」を英単語の "mine" として「マイン」と読んでしまう問題を、端末内で読み上げる経路でも直します。

リモート TTS 側は TrainLCD/Functions#42 で normalizeRomanText に同じ置換を入れています。ただ、Remote Config でリモート TTS が無効な回や、リモート合成に失敗してフォールバックした回は、英語を端末内で読み上げます(Android は端末内蔵 TTS、iOS は VITS)。この経路はアプリの fixEnglishReading しか通らないため、アプリ側にも同じ置換が必要です。

変更の種類

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

変更内容

  • src/utils/englishReading.ts: 読み替え表に mine を追加しました。
    • 置き換え先は Me-nay です。Keisei → Kay-say、Seibu → Say-boo と同じく、英語の辞書語をハイフンでつないだ綴りにしています。
    • 単語境界では区切らず、語中・語頭の mine も置き換えます。StationAPI の駅名には、Tsurugamine・Mitsumineguchi・Akamine のように語中に mine を含むものが多くあります。
    • 前後にローマ字が続く側にはハイフンを挟み、前後の文字とつながって別の綴りとして読まれないようにします。
    • 先頭の大文字・小文字は元の綴りに合わせます。Functions#42 の replaceMine と同じ規則です。
    • 端末内で読む経路ではマクロンを除去しないため、Ō などのラテン拡張文字も語の一部として扱います。
  • src/utils/englishReading.test.ts: 置き換える例・置き換えない例・2回続けて適用しても結果が変わらないことを確かめるケースを追加しました。

変換例

修正前 修正後
Change here for the Mine Line. Change here for the Me-nay Line.
The next station is Nishi-Mine. The next station is Nishi-Me-nay.
Tsurugamine Tsuruga-me-nay
Mitsumineguchi Mitsu-me-nay-guchi
Minenobu Me-nay-nobu
Minami-Ōmine Minami-Ō-me-nay
Minami-Urawa Minami-Urawa(mine を含まないので変わりません)

リモート TTS に送る英文には、この置換を掛けません。置換はサーバー側の normalizeRomanText に任せ、キャッシュキーを原文に揃えるという既存の方針のままです(src/utils/speakableText.ts)。

テスト

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

npm test は、englishReading と toSpeakableText を使うモジュールのテストに絞って実行しました(9 suites / 230 tests がすべて通過)。実機での音声はまだ聞いていません。

npm run lint
npm run typecheck
npx jest src/utils/englishReading src/utils/speakableText src/hooks/tts

関連Issue

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

UI 変更なし: src/utils/** の読み上げ用テキストの変換だけを変えており、画面表示に変化はありません。

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 改善
    • 英語読み上げで「Mine」を文脈に応じて「Me-nay」と発音するよう改善しました。
    • 単語の途中に現れる「mine」も、前後を区切ってより自然に読み上げます。
    • 大文字・小文字やマクロン付き文字を含む表記にも対応しました。
    • 「Minami-Urawa」など、意図しない語は置換されません。
    • 読み上げ処理を重ねて実行しても、結果が変わらないようになりました。

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

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 6a792390-b309-4ae0-8ede-0df91df1553c

📥 Commits

Reviewing files that changed from the base of the PR and between 8968f76 and 3ce667f.

📒 Files selected for processing (2)
  • src/utils/englishReading.test.ts
  • src/utils/englishReading.ts

Included review availability: 0 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

fixEnglishReading が Mine を読み替える規則を追加しました。大小文字、語中位置、マクロン付き文字、ハイフン連結、および二重適用時の不変性をテストします。

Changes

Mine 読み替え

Layer / File(s) Summary
Mine 読み替えルールの実装
src/utils/englishReading.ts
reading が文字列または置換関数を受け取れるように変更しました。Mine を Me-nay または me-nay に読み替えます。
Mine 読み替えの検証
src/utils/englishReading.test.ts
大小文字、語中出現、ハイフン連結、マクロン付き文字、二重適用、および Minami-Urawa を検証します。

Priority: ⬇️ Low

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

Change: Bug fix

Merge Risk: 🔵 Low · up to 3ce66

Native English speech can mispronounce ordinary text containing “mine.” Restrict the replacement to the intended station-name romanization before merging.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed タイトルは、端末内蔵TTS向けに「Mine」の読み替えを追加して誤読を修正する主な変更を明確に示しています。簡潔で変更内容に関連しています。
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 2…
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
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


うさぎは Mine をぴょんと読み替え
Me-nay の音を野原へ届け
ハイフン二つで道を整え
マクロンの文字も仲間に加え
二度読んでも月は変わらない

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

@TinyKitten
TinyKitten merged commit b57b537 into dev Sep 22, 2026
7 checks passed
@TinyKitten
TinyKitten deleted the fix/english-tts-mine-reading branch September 22, 2026 00:04
This was referenced Sep 22, 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.

1 participant