Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

鹿嶋市の表記ゆれ: 「鹿島市」と入力された場合「鹿嶋市」に補正する #171

Merged
merged 3 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/parser/adapter/orthographical_variant_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub trait OrthographicalVariants {
const 崎: Variant;
const 檜: Variant;
const 龍: Variant;
const 嶋: Variant;
}

impl OrthographicalVariants for Variant {
Expand All @@ -23,6 +24,7 @@ impl OrthographicalVariants for Variant {
const 崎: Variant = &["崎", "﨑"];
const 檜: Variant = &["桧", "檜"];
const 龍: Variant = &["龍", "竜"];
const 嶋: Variant = &["嶋", "島"];
}

pub struct OrthographicalVariantAdapter {
Expand Down
1 change: 1 addition & 0 deletions src/parser/read_city.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub fn read_city(input: &str, prefecture: Prefecture) -> Option<(String, String)
match prefecture.name.as_str() {
"茨城県" => {
variant_list.push(Variant::龍);
variant_list.push(Variant::嶋);
}
"東京都" => {
variant_list.push(Variant::檜);
Expand Down
5 changes: 5 additions & 0 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ async fn 県庁所在地のデータテスト() {
run_data_driven_tests("./tests/test_data/県庁所在地の住所データ.csv").await
}

#[tokio::test]
async fn 市区町村名レベルでの表記ゆれ() {
run_data_driven_tests("./tests/test_data/市区町村名レベルでの表記ゆれ.csv").await
}

#[tokio::test]
async fn 異字体旧字体への対応テスト() {
run_data_driven_tests("./tests/test_data/異字体旧字体への対応.csv").await
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
address,prefecture,city,town,rest
# 茨城県
茨城県鹿嶋市大字平井1187-1,茨城県,鹿嶋市,大字平井,1187-1
茨城県鹿島市大字平井1187-1,茨城県,鹿嶋市,大字平井,1187-1
Loading