diff --git a/stationapi/src/domain/ipa.rs b/stationapi/src/domain/ipa.rs index 66f406cc..4b16f0b7 100644 --- a/stationapi/src/domain/ipa.rs +++ b/stationapi/src/domain/ipa.rs @@ -176,6 +176,8 @@ fn lookup_single(c: char) -> Option { 'ン' => return Some(Phoneme::MoraicNasal), 'ッ' => return Some(Phoneme::Geminate), 'ー' => return Some(Phoneme::LongVowel), + // 空白(全角・半角)はそのまま透過 + ' ' | ' ' => return Some(Phoneme::Regular(" ")), _ => return None, }; Some(Phoneme::Regular(ipa)) @@ -588,4 +590,22 @@ mod tests { // ッキョ → kkʲo (only the base consonant 'k' is geminated, not 'kʲ') assert_eq!(ipa("ニッキョウ"), "ɲikkʲoː"); } + + #[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_halfwidth() { + // Half-width (ASCII) space between words should also be accepted + assert_eq!( + ipa("ドッキョウダイガクマエ ソウカマツバラ"), + "dokkʲoːdaiɡakɯmae soːkamat͡sɯbaɾa" + ); + } }