Skip to content

fix: 路線名IPAから共通接尾辞(線/本線/支線)を除去#1412

Merged
TinyKitten merged 3 commits into
devfrom
fix/strip-line-name-suffix-from-ipa
Mar 5, 2026
Merged

fix: 路線名IPAから共通接尾辞(線/本線/支線)を除去#1412
TinyKitten merged 3 commits into
devfrom
fix/strip-line-name-suffix-from-ipa

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Mar 5, 2026

Copy link
Copy Markdown
Member

Summary

  • 路線名カタカナ(例: セイブイケブクロセン)をIPA変換する際、英語TTSでは "Line" と読まれるべき接尾辞(セン/ホンセン/シセン)を事前に除去するようにした
  • シンカンセン(Shinkansen)は英語でもそのまま使われるため例外として保護
  • strip_line_name_suffix() 関数を ipa.rs に追加し、line.rs のDTO変換で適用

Test plan

  • strip_line_name_suffix のユニットテスト追加(セン/ホンセン/シセン除去、シンカンセン保護、ライン等の非対象、空stemの保護)
  • 既存のIPA変換テスト49件すべてパス

🤖 Generated with Claude Code

Summary by CodeRabbit

リリースノート

  • 新機能
    • 路線名の末尾にある既知の片仮名接尾辞を自動で除去する処理を追加しました。特定語(例:新幹線など)は除去対象から保護されます。
  • 改善
    • 除去処理を経てからIPA変換を行う前処理を導入し、路線名のIPA変換精度を向上させました。
  • テスト
    • 末尾除去の振る舞いや境界ケースを検証する単体テストを追加しました。

Line names like セイブイケブクロセン were converted to IPA as
"seibɯikebɯkɯɾoseɴ", but English TTS reads these as "Seibu Ikebukuro
Line", making the trailing "seɴ" incorrect. Strip common suffixes
(セン, ホンセン, シセン) before IPA conversion so only the proper name
portion is transcribed. シンカンセン (Shinkansen) is preserved as it is
used as-is in English.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added the fix 直した label Mar 5, 2026
@coderabbitai

coderabbitai Bot commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4f6557f8-eb6c-4d5b-ae8e-c34bba071dcb

📥 Commits

Reviewing files that changed from the base of the PR and between 857e283 and 06c58f2.

📒 Files selected for processing (1)
  • stationapi/src/domain/ipa.rs

📝 Walkthrough

Walkthrough

駅名カタカナから既知のカタカナ接尾辞を取り除く公開関数 strip_line_name_suffix() をドメイン層に追加し、駅名DTO側で IPA 変換前の前処理として適用する変更を加えた(ユニットテスト追加あり)。

Changes

Cohort / File(s) Summary
ドメイン層:接尾辞削除ロジック
stationapi/src/domain/ipa.rs
strip_line_name_suffix() を追加。LINE_NAME_SUFFIXESLINE_NAME_SUFFIX_EXCEPTIONS 定数を導入し、例外扱いと空文字化回避のロジックを含むユニットテストを追加。
DTO 層:IPA 前処理統合
stationapi/src/use_case/dto/line.rs
katakana_to_ipa() に渡す前に strip_line_name_suffix(&line.line_name_k) を適用するように変更(空結果のフィルタリングは継続)。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐇 うさぎの詩:接尾辞さようなら
ホンセン・シセンをすっと消して
駅名は軽やか、発音は澄んで
小さな一手で道が通るよ
ピョンと跳ねて祝杯をどうぞ 🥕✨

🚥 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 PRのタイトルは、変更内容の主要なポイント(路線名IPAから共通接尾辞を除去すること)を明確かつ簡潔に要約しており、開発者の意図を正確に反映しています。
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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 fix/strip-line-name-suffix-from-ipa

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

@TinyKitten TinyKitten self-assigned this Mar 5, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@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)
stationapi/src/domain/ipa.rs (1)

6-7: ドキュメントコメントの精度向上を推奨

ドキュメントコメントに「線/本線/支線/新幹線」と記載されていますが、新幹線は除去対象ではなく例外として保護されています。実際の動作と一致するよう、コメントを修正することを推奨します。

📝 提案修正
-/// Strip a common line-name suffix (線/本線/支線/新幹線) from a katakana string.
+/// Strip a common line-name suffix (線/本線/支線) from a katakana string.
+/// Note: 新幹線 (Shinkansen) is preserved as an exception since it's used as-is in English.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@stationapi/src/domain/ipa.rs` around lines 6 - 7,
ドキュメントコメントが実際の挙動と一致していません。stationapi/src/domain/ipa.rs
の「線名サフィックスを除去する関数(説明文の先頭行)」のコメントから「新幹線」を除外し、代わりに「新幹線は除去対象ではなく例外として保護される」旨を明記して、コメントを実装に合わせて正確に修正してください(参照箇所:当該ファイルのライン名サフィックス除去関数のドキュメントコメント)。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@stationapi/src/domain/ipa.rs`:
- Around line 6-7: ドキュメントコメントが実際の挙動と一致していません。stationapi/src/domain/ipa.rs
の「線名サフィックスを除去する関数(説明文の先頭行)」のコメントから「新幹線」を除外し、代わりに「新幹線は除去対象ではなく例外として保護される」旨を明記して、コメントを実装に合わせて正確に修正してください(参照箇所:当該ファイルのライン名サフィックス除去関数のドキュメントコメント)。

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fc7a4bd9-295f-4007-b848-593008deac53

📥 Commits

Reviewing files that changed from the base of the PR and between aaf82cf and 857e283.

📒 Files selected for processing (2)
  • stationapi/src/domain/ipa.rs
  • stationapi/src/use_case/dto/line.rs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix 直した

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant