Skip to content

Commit

Permalink
Merge pull request #306 from YuukiToriyama/feature/adapt-spell-varian…
Browse files Browse the repository at this point in the history
…ts/master

表記ゆれへの対応をrelease/v0.1.3-rc.2にマージ
  • Loading branch information
YuukiToriyama authored Jun 15, 2024
2 parents 5ffd6a8 + 0019375 commit 38884c0
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/src/parser/adapter/orthographical_variant_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ pub trait OrthographicalVariants {
const: Variant;
const: Variant;
const: Variant;
const: Variant;
const: Variant;
const: Variant;
const: Variant;
const: Variant;
}

impl OrthographicalVariants for Variant {
Expand All @@ -43,6 +48,11 @@ impl OrthographicalVariants for Variant {
const: Variant = &["治", "冶"];
const: Variant = &["佛", "仏"];
const: Variant = &["澤", "沢"];
const: Variant = &["塚", "塚"];
const: Variant = &["恵", "惠"];
const: Variant = &["穂", "穗"];
const: Variant = &["梼", "檮"];
const: Variant = &["葛󠄀", "葛"];
}

pub struct OrthographicalVariantAdapter {
Expand Down
13 changes: 13 additions & 0 deletions core/src/parser/read_city.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ pub fn read_city(input: &str, prefecture: Prefecture) -> Option<(String, String)
}
"東京都" => {
variant_list.push(Variant::);
variant_list.push(Variant::);
}
"兵庫県" => {
variant_list.push(Variant::);
}
"奈良県" => {
variant_list.push(Variant::);
}
"高知県" => {
variant_list.push(Variant::);
}
"福岡県" => {
variant_list.push(Variant::);
}
_ => {}
}
Expand Down
3 changes: 3 additions & 0 deletions core/src/parser/read_town.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ fn find_town(input: &String, city: &City) -> Option<(String, String)> {
Variant::治,
Variant::佛,
Variant::澤,
Variant::恵,
Variant::穂,
Variant::梼,
],
};
if let Some(result) = adapter.apply(input, &town.name) {
Expand Down
11 changes: 11 additions & 0 deletions tests/test_data/市区町村名レベルでの表記ゆれ.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,14 @@ address,prefecture,city,town,rest
# 茨城県
茨城県鹿嶋市大字平井1187-1,茨城県,鹿嶋市,大字平井,1187-1
茨城県鹿島市大字平井1187-1,茨城県,鹿嶋市,大字平井,1187-1
# 東京都
東京都葛飾区立石5-13-1,東京都,葛飾区,立石五丁目,13-1
東京都葛󠄀飾区立石5-13-1,東京都,葛飾区,立石五丁目,13-1
# 兵庫県
兵庫県宝塚市売布東の町8-19,兵庫県,宝塚市,売布東の町,8-19
兵庫県宝塚市売布東の町8-19,兵庫県,宝塚市,売布東の町,8-19
兵庫県宝塚市武庫川町1-1,兵庫県,宝塚市,武庫川町,1-1
兵庫県宝塚市武庫川町1-1,兵庫県,宝塚市,武庫川町,1-1
# 奈良県
奈良県葛󠄀城市柿本166番地,奈良県,葛城市,柿本,166番地
奈良県葛城市柿本166番地,奈良県,葛城市,柿本,166番地
13 changes: 13 additions & 0 deletions tests/test_data/異字体旧字体への対応.csv
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,16 @@ address,prefecture,city,town,rest
# 「棚沢」と「棚澤」の表記ゆれへの対応
東京都西多摩郡奥多摩町棚澤446,東京都,西多摩郡奥多摩町,棚澤,446
東京都西多摩郡奥多摩町棚沢446,東京都,西多摩郡奥多摩町,棚澤,446
# 「須恵」と「須惠」の表記ゆれへの対応
福岡県糟屋郡須恵町大字上須恵1117,福岡県,糟屋郡須恵町,大字上須惠,1117
福岡県糟屋郡須恵町大字上須惠1117,福岡県,糟屋郡須恵町,大字上須惠,1117
福岡県糟屋郡須惠町大字上須恵1117,福岡県,糟屋郡須恵町,大字上須惠,1117
福岡県糟屋郡須惠町大字上須惠1117,福岡県,糟屋郡須恵町,大字上須惠,1117
# 「梼原」と「檮原」の表記ゆれへの対応
高知県高岡郡檮原町檮原1444-1,高知県,高岡郡檮原町,梼原,1444-1
高知県高岡郡檮原町梼原1444-1,高知県,高岡郡檮原町,梼原,1444-1
高知県高岡郡梼原町檮原1444-1,高知県,高岡郡檮原町,梼原,1444-1
高知県高岡郡梼原町梼原1444-1,高知県,高岡郡檮原町,梼原,1444-1
# 「道穂」と「道穗」の表記ゆれへの対応
奈良県葛城市南道穗171-3,奈良県,葛城市,南道穗,171-3
奈良県葛城市南道穂171-3,奈良県,葛城市,南道穗,171-3

0 comments on commit 38884c0

Please sign in to comment.