fix: handle full-width space in katakana-to-IPA conversion#1411
Conversation
Station names like "ドッキョウダイガクマエ ソウカマツバラ" contain a full-width space (U+3000) which was not mapped in lookup_single, causing katakana_to_ipa to return None and nameIpa to be null. https://claude.ai/code/session_01Pjo9E2fzdLZEkvNqxXAPeQ
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughIPA変換のシングルキャラクタルックアップを拡張し、全角スペース(' ')と半角スペース(' ')を Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
stationapi/src/domain/ipa.rs (1)
594-601: 半角スペースの回帰テストも追加しておくとより堅牢です。実装は全角・半角の両方を受け付けるため、半角スペース入力のケースも 1 件入れておくと将来の退行を防ぎやすいです。
✅ 追加テスト例
#[test] fn test_dokkyo_daigakumae_soka_matsubara() { // Full-width space between words should be preserved assert_eq!( ipa("ドッキョウダイガクマエ ソウカマツバラ"), "dokkʲoːdaiɡakɯmae soːkamat͡sɯbaɾa" ); } + + #[test] + fn test_dokkyo_daigakumae_soka_matsubara_half_width_space() { + assert_eq!( + ipa("ドッキョウダイガクマエ ソウカマツバラ"), + "dokkʲoːdaiɡakɯmae soːkamat͡sɯbaɾa" + ); + }🤖 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 594 - 601, Add a sibling unit test that mirrors test_dokkyo_daigakumae_soka_matsubara but uses a half-width (ASCII) space between the two phrases to ensure ipa(...) accepts both full-width and half-width spaces; create a test function (e.g., test_dokkyo_daigakumae_soka_matsubara_halfwidth) that calls ipa("ドッキョウダイガクマエ ソウカマツバラ") and asserts the same expected transcription "dokkʲoːdaiɡakɯmae soːkamat͡sɯbaɾa", referencing the existing ipa function and test pattern so the regression is covered.
🤖 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 594-601: Add a sibling unit test that mirrors
test_dokkyo_daigakumae_soka_matsubara but uses a half-width (ASCII) space
between the two phrases to ensure ipa(...) accepts both full-width and
half-width spaces; create a test function (e.g.,
test_dokkyo_daigakumae_soka_matsubara_halfwidth) that calls ipa("ドッキョウダイガクマエ
ソウカマツバラ") and asserts the same expected transcription "dokkʲoːdaiɡakɯmae
soːkamat͡sɯbaɾa", referencing the existing ipa function and test pattern so the
regression is covered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d65f304d-f54a-4d78-9aa9-7a060e34e016
📒 Files selected for processing (1)
stationapi/src/domain/ipa.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
lookup_singleで未定義だったため、katakana_to_ipaがNoneを返しnameIpaが null になっていた問題を修正lookup_singleに全角スペースと半角スペースのマッピングを追加(IPA出力では半角スペースとして透過)Test plan
SQLX_OFFLINE=true cargo test --lib domain::ipa— 42テスト全パスhttps://claude.ai/code/session_01Pjo9E2fzdLZEkvNqxXAPeQ
Summary by CodeRabbit