japanese_address_parser 3.1.1 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53a31a273123299a2e48aea1fa82e3bd4d0d33d7e8f1a694ef39a1926004576a
4
- data.tar.gz: 21198c935bf0dc0892f5ff395403ef4aaa08d03f60d576e7cfbeaa556ae9ebed
3
+ metadata.gz: bfa568e2017ad20c3226026019e10c0d3b0c7d02c5dc249f986e37691939c4c8
4
+ data.tar.gz: ecce6dcfcdbe8013c485ee20c677b1fce17105a3cf205009c4d64fcd5fb9b925
5
5
  SHA512:
6
- metadata.gz: 742a64618c177ef65bf6dcb0677993ba531f734efda24b81dc2a5f0839aef47ae42c57e829b5c9a3e9b984dbb4b1960303a1b05c8d88dcfc516b473948f8219e
7
- data.tar.gz: dab2e5dedbeda742af992a5b9574697523f9816c9765741c8f6b9eec6b06723c98247f9248d20a61aeebdcaf541d09d734c2a30a12ca22a47b5b2f1ab2da5694
6
+ metadata.gz: 35bb2397beb4b209c570c6e999eb7c12dde3d7d1750f7c6f84a071d3f6d89edda36ff37858842e18f684b16962462ae9b718f5da367bda070e1cb94e068a9135
7
+ data.tar.gz: d07ddcec5a9ee546f731e13de357c3e4669e40648b9282084a253aa6ae550108ba47244d13724df6458b7594449b7b01598928da8f1334acd0c7df3d4b55bb2a
data/.rubocop.yml CHANGED
@@ -17,6 +17,12 @@ Metrics/BlockLength:
17
17
  RSpec/ContextWording:
18
18
  Enabled: false
19
19
 
20
+ RSpec/ExampleLength:
21
+ Enabled: false
22
+
23
+ RSpec/MultipleExpectations:
24
+ Enabled: false
25
+
20
26
  # MITなのでファイルの著作権は記載しない。
21
27
  Style/Copyright:
22
28
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -5,6 +5,7 @@ Change Log の形式は [Keep a Changelog](http://keepachangelog.com/) に従い
5
5
  またバージョンの付け方は [Semantic Versioning](https://semver.org/) に従います。
6
6
 
7
7
  ## [Unreleased]
8
+
8
9
  ### Added
9
10
 
10
11
  ### Changed
@@ -17,6 +18,28 @@ Change Log の形式は [Keep a Changelog](http://keepachangelog.com/) に従い
17
18
 
18
19
  ### Security
19
20
 
21
+ ## [3.2.0]
22
+
23
+ ### Changed
24
+
25
+ - [#105](https://github.com/yamat47/japanese_address_parser/pull/105) Update CI settings.([@yamat47](https://github.com/yamat47))
26
+ - [#103](https://github.com/yamat47/japanese_address_parser/pull/103) Bump @geolonia/normalize-japanese-addresses from 2.9.2 to 2.10.0 in /js([@yamat47](https://github.com/yamat47))
27
+ - [#104](https://github.com/yamat47/japanese_address_parser/pull/104) Bump geolonia-japanese-addresses from a8df8fe to 406bb43([@yamat47](https://github.com/yamat47))
28
+
29
+ ### Fixed
30
+
31
+ - [#102](https://github.com/yamat47/japanese_address_parser/pull/102) #full_addressが処理前の住所の一部のみを返すようになっていた不具合を解消した。([@yamat47](https://github.com/yamat47))
32
+
33
+ ## [3.1.2] - 2023-09-23
34
+
35
+ ### Changed
36
+
37
+ - [#97](https://github.com/yamat47/japanese_address_parser/pull/97) parser gem のバージョンを最新の(3.2.2.3)にアップデートする([@takatea](https://github.com/takatea))
38
+
39
+ ### Fixed
40
+
41
+ - [#99](https://github.com/yamat47/japanese_address_parser/pull/99) 最新のRuby(head)でCIを実行できるようにする
42
+
20
43
  ## [3.1.1] - 2023-09-07
21
44
 
22
45
  ### Changed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- japanese_address_parser (3.1.1)
4
+ japanese_address_parser (3.2.0)
5
5
  schmooze
6
6
 
7
7
  GEM
@@ -27,8 +27,10 @@ GEM
27
27
  rb-inotify (~> 0.9, >= 0.9.10)
28
28
  minitest (5.19.0)
29
29
  parallel (1.22.1)
30
- parser (3.1.2.1)
30
+ parser (3.2.2.3)
31
31
  ast (~> 2.4.1)
32
+ racc
33
+ racc (1.7.1)
32
34
  rainbow (3.1.1)
33
35
  rake (13.0.6)
34
36
  rb-fsevent (0.11.2)
@@ -89,6 +91,7 @@ PLATFORMS
89
91
  aarch64-linux-musl
90
92
  arm64-darwin-21
91
93
  arm64-darwin-22
94
+ arm64-darwin-23
92
95
  x86_64-darwin-21
93
96
  x86_64-linux
94
97
 
@@ -9,9 +9,9 @@
9
9
  "integrity": "sha512-xzSsIHhyyjqNpW8qSh5bFMu3FJvyJGBbNZ/t8clPHkigjUdZ7Ck8wkzCkcwlVd00RkoHwGDLnvXx5W0WiGK0TQ=="
10
10
  },
11
11
  "node_modules/@geolonia/normalize-japanese-addresses": {
12
- "version": "2.9.2",
13
- "resolved": "https://registry.npmjs.org/@geolonia/normalize-japanese-addresses/-/normalize-japanese-addresses-2.9.2.tgz",
14
- "integrity": "sha512-sbeV/seJ/ue6pn2sLo+Ccunl6eB3yNhrUIzNpT2IiR9Fw6fW5f1lLdApODqhTmz++xr1dyPwZOzTXCGEaXejDA==",
12
+ "version": "2.10.0",
13
+ "resolved": "https://registry.npmjs.org/@geolonia/normalize-japanese-addresses/-/normalize-japanese-addresses-2.10.0.tgz",
14
+ "integrity": "sha512-ubGDWbX5CeT4xgbFPOSEwo6Ir404CIX/6LE9exE+K9/+7rNhUvCk84sWwu9xZB1Fl5aH/9cIpPMIFlJrXdt3IQ==",
15
15
  "dependencies": {
16
16
  "@geolonia/japanese-numeral": "^0.1.16",
17
17
  "isomorphic-unfetch": "^3.1.0",
@@ -378,21 +378,21 @@
378
378
  pref: '香川県',
379
379
  city: '仲多度郡まんのう町',
380
380
  town: '勝浦',
381
- pattern: '^字?家6',
381
+ pattern: '^字?家[6六]',
382
382
  result: '家六',
383
383
  },
384
384
  {
385
385
  pref: '愛知県',
386
386
  city: 'あま市',
387
387
  town: '西今宿',
388
- pattern: '^字?梶村1',
388
+ pattern: '^字?梶村[1一]',
389
389
  result: '梶村一',
390
390
  },
391
391
  {
392
392
  pref: '香川県',
393
393
  city: '丸亀市',
394
394
  town: '原田町',
395
- pattern: '^字?東三分1',
395
+ pattern: '^字?東三分[1一]',
396
396
  result: '東三分一',
397
397
  },
398
398
  ];
@@ -1812,29 +1812,29 @@
1812
1812
  return dist.number2kanji(Number(num));
1813
1813
  });
1814
1814
  })
1815
- .replace(/(([0-9〇一二三四五六七八九十百千]+)(番地?)([0-9〇一二三四五六七八九十百千]+)号)\s*(.+)/, '$1 $5')
1816
- .replace(/([0-9〇一二三四五六七八九十百千]+)\s*(番地?)\s*([0-9〇一二三四五六七八九十百千]+)\s*号?/, '$1-$3')
1817
- .replace(/([0-9〇一二三四五六七八九十百千]+)番地?/, '$1')
1818
- .replace(/([0-9〇一二三四五六七八九十百千]+)の/g, '$1-')
1819
- .replace(/([0-9〇一二三四五六七八九十百千]+)[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g, function (match) {
1815
+ .replace(/(([0-9]+|[〇一二三四五六七八九十百千]+)(番地?)([0-9]+|[〇一二三四五六七八九十百千]+)号)\s*(.+)/, '$1 $5')
1816
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)\s*(番地?)\s*([0-9]+|[〇一二三四五六七八九十百千]+)\s*号?/, '$1-$3')
1817
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)番地?/, '$1')
1818
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)の/g, '$1-')
1819
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g, function (match) {
1820
1820
  return kan2num(match).replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g, '-');
1821
1821
  })
1822
- .replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]([0-9〇一二三四五六七八九十百千]+)/g, function (match) {
1822
+ .replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]([0-9]+|[〇一二三四五六七八九十百千]+)/g, function (match) {
1823
1823
  return kan2num(match).replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g, '-');
1824
1824
  })
1825
- .replace(/([0-9〇一二三四五六七八九十百千]+)-/, function (s) {
1825
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)-/, function (s) {
1826
1826
  // `1-` のようなケース
1827
1827
  return kan2num(s);
1828
1828
  })
1829
- .replace(/-([0-9〇一二三四五六七八九十百千]+)/, function (s) {
1829
+ .replace(/-([0-9]+|[〇一二三四五六七八九十百千]+)/, function (s) {
1830
1830
  // `-1` のようなケース
1831
1831
  return kan2num(s);
1832
1832
  })
1833
- .replace(/-[^0-9]([0-9〇一二三四五六七八九十百千]+)/, function (s) {
1833
+ .replace(/-[^0-9]([0-9]+|[〇一二三四五六七八九十百千]+)/, function (s) {
1834
1834
  // `-あ1` のようなケース
1835
1835
  return kan2num(zen2han(s));
1836
1836
  })
1837
- .replace(/([0-9〇一二三四五六七八九十百千]+)$/, function (s) {
1837
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)$/, function (s) {
1838
1838
  // `串本町串本1234` のようなケース
1839
1839
  return kan2num(s);
1840
1840
  })
@@ -372,21 +372,21 @@ var addrPatches = [
372
372
  pref: '香川県',
373
373
  city: '仲多度郡まんのう町',
374
374
  town: '勝浦',
375
- pattern: '^字?家6',
375
+ pattern: '^字?家[6六]',
376
376
  result: '家六',
377
377
  },
378
378
  {
379
379
  pref: '愛知県',
380
380
  city: 'あま市',
381
381
  town: '西今宿',
382
- pattern: '^字?梶村1',
382
+ pattern: '^字?梶村[1一]',
383
383
  result: '梶村一',
384
384
  },
385
385
  {
386
386
  pref: '香川県',
387
387
  city: '丸亀市',
388
388
  town: '原田町',
389
- pattern: '^字?東三分1',
389
+ pattern: '^字?東三分[1一]',
390
390
  result: '東三分一',
391
391
  },
392
392
  ];
@@ -1806,29 +1806,29 @@ var normalize$1 = function (address, _option) {
1806
1806
  return dist.number2kanji(Number(num));
1807
1807
  });
1808
1808
  })
1809
- .replace(/(([0-9〇一二三四五六七八九十百千]+)(番地?)([0-9〇一二三四五六七八九十百千]+)号)\s*(.+)/, '$1 $5')
1810
- .replace(/([0-9〇一二三四五六七八九十百千]+)\s*(番地?)\s*([0-9〇一二三四五六七八九十百千]+)\s*号?/, '$1-$3')
1811
- .replace(/([0-9〇一二三四五六七八九十百千]+)番地?/, '$1')
1812
- .replace(/([0-9〇一二三四五六七八九十百千]+)の/g, '$1-')
1813
- .replace(/([0-9〇一二三四五六七八九十百千]+)[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g, function (match) {
1809
+ .replace(/(([0-9]+|[〇一二三四五六七八九十百千]+)(番地?)([0-9]+|[〇一二三四五六七八九十百千]+)号)\s*(.+)/, '$1 $5')
1810
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)\s*(番地?)\s*([0-9]+|[〇一二三四五六七八九十百千]+)\s*号?/, '$1-$3')
1811
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)番地?/, '$1')
1812
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)の/g, '$1-')
1813
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g, function (match) {
1814
1814
  return kan2num(match).replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g, '-');
1815
1815
  })
1816
- .replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]([0-9〇一二三四五六七八九十百千]+)/g, function (match) {
1816
+ .replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]([0-9]+|[〇一二三四五六七八九十百千]+)/g, function (match) {
1817
1817
  return kan2num(match).replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g, '-');
1818
1818
  })
1819
- .replace(/([0-9〇一二三四五六七八九十百千]+)-/, function (s) {
1819
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)-/, function (s) {
1820
1820
  // `1-` のようなケース
1821
1821
  return kan2num(s);
1822
1822
  })
1823
- .replace(/-([0-9〇一二三四五六七八九十百千]+)/, function (s) {
1823
+ .replace(/-([0-9]+|[〇一二三四五六七八九十百千]+)/, function (s) {
1824
1824
  // `-1` のようなケース
1825
1825
  return kan2num(s);
1826
1826
  })
1827
- .replace(/-[^0-9]([0-9〇一二三四五六七八九十百千]+)/, function (s) {
1827
+ .replace(/-[^0-9]([0-9]+|[〇一二三四五六七八九十百千]+)/, function (s) {
1828
1828
  // `-あ1` のようなケース
1829
1829
  return kan2num(zen2han(s));
1830
1830
  })
1831
- .replace(/([0-9〇一二三四五六七八九十百千]+)$/, function (s) {
1831
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)$/, function (s) {
1832
1832
  // `串本町串本1234` のようなケース
1833
1833
  return kan2num(s);
1834
1834
  })
@@ -108,21 +108,21 @@ var addrPatches = [
108
108
  pref: '香川県',
109
109
  city: '仲多度郡まんのう町',
110
110
  town: '勝浦',
111
- pattern: '^字?家6',
111
+ pattern: '^字?家[6六]',
112
112
  result: '家六',
113
113
  },
114
114
  {
115
115
  pref: '愛知県',
116
116
  city: 'あま市',
117
117
  town: '西今宿',
118
- pattern: '^字?梶村1',
118
+ pattern: '^字?梶村[1一]',
119
119
  result: '梶村一',
120
120
  },
121
121
  {
122
122
  pref: '香川県',
123
123
  city: '丸亀市',
124
124
  town: '原田町',
125
- pattern: '^字?東三分1',
125
+ pattern: '^字?東三分[1一]',
126
126
  result: '東三分一',
127
127
  },
128
128
  ];
@@ -764,29 +764,29 @@ var normalize$1 = function (address, _option) {
764
764
  return japaneseNumeral.number2kanji(Number(num));
765
765
  });
766
766
  })
767
- .replace(/(([0-9〇一二三四五六七八九十百千]+)(番地?)([0-9〇一二三四五六七八九十百千]+)号)\s*(.+)/, '$1 $5')
768
- .replace(/([0-9〇一二三四五六七八九十百千]+)\s*(番地?)\s*([0-9〇一二三四五六七八九十百千]+)\s*号?/, '$1-$3')
769
- .replace(/([0-9〇一二三四五六七八九十百千]+)番地?/, '$1')
770
- .replace(/([0-9〇一二三四五六七八九十百千]+)の/g, '$1-')
771
- .replace(/([0-9〇一二三四五六七八九十百千]+)[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g, function (match) {
767
+ .replace(/(([0-9]+|[〇一二三四五六七八九十百千]+)(番地?)([0-9]+|[〇一二三四五六七八九十百千]+)号)\s*(.+)/, '$1 $5')
768
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)\s*(番地?)\s*([0-9]+|[〇一二三四五六七八九十百千]+)\s*号?/, '$1-$3')
769
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)番地?/, '$1')
770
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)の/g, '$1-')
771
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g, function (match) {
772
772
  return kan2num(match).replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g, '-');
773
773
  })
774
- .replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]([0-9〇一二三四五六七八九十百千]+)/g, function (match) {
774
+ .replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]([0-9]+|[〇一二三四五六七八九十百千]+)/g, function (match) {
775
775
  return kan2num(match).replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g, '-');
776
776
  })
777
- .replace(/([0-9〇一二三四五六七八九十百千]+)-/, function (s) {
777
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)-/, function (s) {
778
778
  // `1-` のようなケース
779
779
  return kan2num(s);
780
780
  })
781
- .replace(/-([0-9〇一二三四五六七八九十百千]+)/, function (s) {
781
+ .replace(/-([0-9]+|[〇一二三四五六七八九十百千]+)/, function (s) {
782
782
  // `-1` のようなケース
783
783
  return kan2num(s);
784
784
  })
785
- .replace(/-[^0-9]([0-9〇一二三四五六七八九十百千]+)/, function (s) {
785
+ .replace(/-[^0-9]([0-9]+|[〇一二三四五六七八九十百千]+)/, function (s) {
786
786
  // `-あ1` のようなケース
787
787
  return kan2num(zen2han(s));
788
788
  })
789
- .replace(/([0-9〇一二三四五六七八九十百千]+)$/, function (s) {
789
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)$/, function (s) {
790
790
  // `串本町串本1234` のようなケース
791
791
  return kan2num(s);
792
792
  })
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geolonia/normalize-japanese-addresses",
3
- "version": "2.9.2",
3
+ "version": "2.10.0",
4
4
  "description": "",
5
5
  "browser": "./dist/main-browser.js",
6
6
  "main": "./dist/main-node.js",
@@ -3,21 +3,21 @@ const addrPatches = [
3
3
  pref: '香川県',
4
4
  city: '仲多度郡まんのう町',
5
5
  town: '勝浦',
6
- pattern: '^字?家6',
6
+ pattern: '^字?家[6六]',
7
7
  result: '家六',
8
8
  },
9
9
  {
10
10
  pref: '愛知県',
11
11
  city: 'あま市',
12
12
  town: '西今宿',
13
- pattern: '^字?梶村1',
13
+ pattern: '^字?梶村[1一]',
14
14
  result: '梶村一',
15
15
  },
16
16
  {
17
17
  pref: '香川県',
18
18
  city: '丸亀市',
19
19
  town: '原田町',
20
- pattern: '^字?東三分1',
20
+ pattern: '^字?東三分[1一]',
21
21
  result: '東三分一',
22
22
  },
23
23
  ]
@@ -435,40 +435,40 @@ export const normalize: Normalizer = async (
435
435
  })
436
436
  })
437
437
  .replace(
438
- /(([0-9〇一二三四五六七八九十百千]+)(番地?)([0-9〇一二三四五六七八九十百千]+)号)\s*(.+)/,
438
+ /(([0-9]+|[〇一二三四五六七八九十百千]+)(番地?)([0-9]+|[〇一二三四五六七八九十百千]+)号)\s*(.+)/,
439
439
  '$1 $5',
440
440
  )
441
441
  .replace(
442
- /([0-9〇一二三四五六七八九十百千]+)\s*(番地?)\s*([0-9〇一二三四五六七八九十百千]+)\s*号?/,
442
+ /([0-9]+|[〇一二三四五六七八九十百千]+)\s*(番地?)\s*([0-9]+|[〇一二三四五六七八九十百千]+)\s*号?/,
443
443
  '$1-$3',
444
444
  )
445
- .replace(/([0-9〇一二三四五六七八九十百千]+)番地?/, '$1')
446
- .replace(/([0-9〇一二三四五六七八九十百千]+)の/g, '$1-')
445
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)番地?/, '$1')
446
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)の/g, '$1-')
447
447
  .replace(
448
- /([0-9〇一二三四五六七八九十百千]+)[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g,
448
+ /([0-9]+|[〇一二三四五六七八九十百千]+)[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g,
449
449
  (match) => {
450
450
  return kan2num(match).replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g, '-')
451
451
  },
452
452
  )
453
453
  .replace(
454
- /[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]([0-9〇一二三四五六七八九十百千]+)/g,
454
+ /[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]([0-9]+|[〇一二三四五六七八九十百千]+)/g,
455
455
  (match) => {
456
456
  return kan2num(match).replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g, '-')
457
457
  },
458
458
  )
459
- .replace(/([0-9〇一二三四五六七八九十百千]+)-/, (s) => {
459
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)-/, (s) => {
460
460
  // `1-` のようなケース
461
461
  return kan2num(s)
462
462
  })
463
- .replace(/-([0-9〇一二三四五六七八九十百千]+)/, (s) => {
463
+ .replace(/-([0-9]+|[〇一二三四五六七八九十百千]+)/, (s) => {
464
464
  // `-1` のようなケース
465
465
  return kan2num(s)
466
466
  })
467
- .replace(/-[^0-9]([0-9〇一二三四五六七八九十百千]+)/, (s) => {
467
+ .replace(/-[^0-9]([0-9]+|[〇一二三四五六七八九十百千]+)/, (s) => {
468
468
  // `-あ1` のようなケース
469
469
  return kan2num(zen2han(s))
470
470
  })
471
- .replace(/([0-9〇一二三四五六七八九十百千]+)$/, (s) => {
471
+ .replace(/([0-9]+|[〇一二三四五六七八九十百千]+)$/, (s) => {
472
472
  // `串本町串本1234` のようなケース
473
473
  return kan2num(s)
474
474
  })
data/js/package-lock.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "": {
7
7
  "name": "japanese_address_parser",
8
8
  "dependencies": {
9
- "@geolonia/normalize-japanese-addresses": "^2.9.2"
9
+ "@geolonia/normalize-japanese-addresses": "^2.10.0"
10
10
  },
11
11
  "devDependencies": {}
12
12
  },
@@ -16,9 +16,9 @@
16
16
  "integrity": "sha512-xzSsIHhyyjqNpW8qSh5bFMu3FJvyJGBbNZ/t8clPHkigjUdZ7Ck8wkzCkcwlVd00RkoHwGDLnvXx5W0WiGK0TQ=="
17
17
  },
18
18
  "node_modules/@geolonia/normalize-japanese-addresses": {
19
- "version": "2.9.2",
20
- "resolved": "https://registry.npmjs.org/@geolonia/normalize-japanese-addresses/-/normalize-japanese-addresses-2.9.2.tgz",
21
- "integrity": "sha512-sbeV/seJ/ue6pn2sLo+Ccunl6eB3yNhrUIzNpT2IiR9Fw6fW5f1lLdApODqhTmz++xr1dyPwZOzTXCGEaXejDA==",
19
+ "version": "2.10.0",
20
+ "resolved": "https://registry.npmjs.org/@geolonia/normalize-japanese-addresses/-/normalize-japanese-addresses-2.10.0.tgz",
21
+ "integrity": "sha512-ubGDWbX5CeT4xgbFPOSEwo6Ir404CIX/6LE9exE+K9/+7rNhUvCk84sWwu9xZB1Fl5aH/9cIpPMIFlJrXdt3IQ==",
22
22
  "dependencies": {
23
23
  "@geolonia/japanese-numeral": "^0.1.16",
24
24
  "isomorphic-unfetch": "^3.1.0",
@@ -101,9 +101,9 @@
101
101
  "integrity": "sha512-xzSsIHhyyjqNpW8qSh5bFMu3FJvyJGBbNZ/t8clPHkigjUdZ7Ck8wkzCkcwlVd00RkoHwGDLnvXx5W0WiGK0TQ=="
102
102
  },
103
103
  "@geolonia/normalize-japanese-addresses": {
104
- "version": "2.9.2",
105
- "resolved": "https://registry.npmjs.org/@geolonia/normalize-japanese-addresses/-/normalize-japanese-addresses-2.9.2.tgz",
106
- "integrity": "sha512-sbeV/seJ/ue6pn2sLo+Ccunl6eB3yNhrUIzNpT2IiR9Fw6fW5f1lLdApODqhTmz++xr1dyPwZOzTXCGEaXejDA==",
104
+ "version": "2.10.0",
105
+ "resolved": "https://registry.npmjs.org/@geolonia/normalize-japanese-addresses/-/normalize-japanese-addresses-2.10.0.tgz",
106
+ "integrity": "sha512-ubGDWbX5CeT4xgbFPOSEwo6Ir404CIX/6LE9exE+K9/+7rNhUvCk84sWwu9xZB1Fl5aH/9cIpPMIFlJrXdt3IQ==",
107
107
  "requires": {
108
108
  "@geolonia/japanese-numeral": "^0.1.16",
109
109
  "isomorphic-unfetch": "^3.1.0",
data/js/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": true,
4
4
  "description": "JapaneseAddressParserは日本の住所をパースすることができるRuby gemです。",
5
5
  "dependencies": {
6
- "@geolonia/normalize-japanese-addresses": "^2.9.2"
6
+ "@geolonia/normalize-japanese-addresses": "^2.10.0"
7
7
  },
8
8
  "devDependencies": {}
9
9
  }
@@ -5,12 +5,12 @@ require_relative './models/prefecture'
5
5
 
6
6
  module JapaneseAddressParser
7
7
  module AddressParser
8
- def call(full_address)
9
- prefecture = ::JapaneseAddressParser::Models::Prefecture.all.find { |candidate| full_address.start_with?(candidate.name) }
8
+ def call(normalized:, full_address:)
9
+ prefecture = ::JapaneseAddressParser::Models::Prefecture.all.find { |candidate| normalized.start_with?(candidate.name) }
10
10
 
11
11
  return _build_address(full_address: full_address) if prefecture.nil?
12
12
 
13
- city_and_after = full_address.delete_prefix(prefecture.name)
13
+ city_and_after = normalized.delete_prefix(prefecture.name)
14
14
  city = prefecture.cities.find { |candidate| city_and_after.start_with?(candidate.name) }
15
15
 
16
16
  return _build_address(full_address: full_address, prefecture: prefecture) if city.nil?
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JapaneseAddressParser
4
- VERSION = '3.1.1'
4
+ VERSION = '3.2.0'
5
5
  public_constant :VERSION
6
6
  end
@@ -20,7 +20,7 @@ module JapaneseAddressParser
20
20
 
21
21
  # このライブラリで探索するのは町域まで。
22
22
  # それ以降のデータを使って探索するとデータと名前が一致しないことがあるので、町域までのデータを使う。
23
- ::JapaneseAddressParser::AddressParser.call("#{normalized['pref']}#{normalized['city']}#{normalized['town']}")
23
+ ::JapaneseAddressParser::AddressParser.call(normalized: "#{normalized['pref']}#{normalized['city']}#{normalized['town']}", full_address: full_address)
24
24
  end
25
25
 
26
26
  module_function :call, :call!, :_call
@@ -20,7 +20,7 @@ module JapaneseAddressParser
20
20
  end
21
21
 
22
22
  module AddressParser
23
- def self.call: (String full_address) -> Models::Address
23
+ def self.call: (normalized: String, full_address: String) -> Models::Address
24
24
  end
25
25
 
26
26
  module Models
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: japanese_address_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamaguchi Takuya
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-07 00:00:00.000000000 Z
11
+ date: 2023-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: schmooze
@@ -4160,7 +4160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
4160
4160
  - !ruby/object:Gem::Version
4161
4161
  version: '0'
4162
4162
  requirements: []
4163
- rubygems_version: 3.4.18
4163
+ rubygems_version: 3.5.0.dev
4164
4164
  signing_key:
4165
4165
  specification_version: 4
4166
4166
  summary: Japanese address parser written in Ruby.