From 19ca591e7dda54f83ea5a58a68118f2b3ae6452c Mon Sep 17 00:00:00 2001 From: Tsubasa SEKIGUCHI Date: Fri, 2 Jan 2026 03:39:42 +0000 Subject: [PATCH] =?UTF-8?q?=E3=83=90=E3=82=B9=E5=81=9C=E5=90=8D=E3=81=AF?= =?UTF-8?q?=E3=82=AB=E3=82=BF=E3=82=AB=E3=83=8A=E3=81=AB=E5=A4=89=E6=8F=9B?= =?UTF-8?q?=E3=81=97=E3=81=A6=E6=8C=BF=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stationapi/src/import.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/stationapi/src/import.rs b/stationapi/src/import.rs index a051aa9d..23b9a2ed 100644 --- a/stationapi/src/import.rs +++ b/stationapi/src/import.rs @@ -1157,6 +1157,21 @@ fn is_bus_feature_disabled() -> bool { // GTFS to Stations/Lines Integration // ============================================================ +/// Convert hiragana characters to katakana +/// Hiragana range: U+3041 to U+3096 +/// Katakana range: U+30A1 to U+30F6 +fn hiragana_to_katakana(s: &str) -> String { + s.chars() + .map(|c| { + if ('\u{3041}'..='\u{3096}').contains(&c) { + char::from_u32(c as u32 + 0x60).unwrap_or(c) + } else { + c + } + }) + .collect() +} + /// FNV-1a hash function for deterministic hashing across process invocations /// Unlike DefaultHasher, this produces consistent results across runs fn fnv1a_hash(data: &[u8]) -> u64 { @@ -1721,7 +1736,12 @@ async fn integrate_gtfs_stops_to_stations( .bind(station_cd) .bind(station_g_cd) .bind(&stop.stop_name) - .bind(stop.stop_name_k.as_ref().unwrap_or(&stop.stop_name)) + .bind( + stop.stop_name_k + .as_ref() + .map(|k| hiragana_to_katakana(k)) + .unwrap_or_else(|| stop.stop_name.clone()), + ) .bind(&stop.stop_name_r) .bind(&stop.stop_name_zh) .bind(&stop.stop_name_ko)