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

release/v0.1.0-beta.8をmainブランチにマージ #175

Merged
merged 12 commits into from
Feb 12, 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: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "japanese-address-parser"
version = "0.1.0-beta.7"
version = "0.1.0-beta.8"
edition = "2021"
description = "A Rust Library to parse japanses addresses."
authors = ["Yuuki Toriyama <github@toriyama.dev>"]
Expand Down
4 changes: 4 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,8 @@ pub trait OrthographicalVariants {
const 崎: Variant;
const 檜: Variant;
const 龍: Variant;
const 竈: Variant;
const 嶋: Variant;
}

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

pub struct OrthographicalVariantAdapter {
Expand Down
4 changes: 4 additions & 0 deletions src/parser/read_city.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ pub fn read_city(input: &str, prefecture: Prefecture) -> Option<(String, String)
}
let mut variant_list = vec![Variant::ケ];
match prefecture.name.as_str() {
"宮城県" => {
variant_list.push(Variant::竈);
}
"茨城県" => {
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,7 @@
address,prefecture,city,town,rest
# 宮城県
宮城県塩竈市海岸通15-1,宮城県,塩竈市,海岸通,15-1
宮城県塩釜市海岸通15-1,宮城県,塩竈市,海岸通,15-1
# 茨城県
茨城県鹿嶋市大字平井1187-1,茨城県,鹿嶋市,大字平井,1187-1
茨城県鹿島市大字平井1187-1,茨城県,鹿嶋市,大字平井,1187-1
Loading