address_composer 0.1.2.pre → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/main.yml +25 -0
  3. data/.gitignore +2 -0
  4. data/.gitmodules +1 -1
  5. data/Gemfile.lock +24 -23
  6. data/README.md +3 -1
  7. data/address-formatting/.travis.yml +8 -6
  8. data/address-formatting/README.md +7 -3
  9. data/address-formatting/SECURITY.md +5 -0
  10. data/address-formatting/conf/abbreviations/{dk.yaml → da.yaml} +0 -3
  11. data/address-formatting/conf/abbreviations/de.yaml +0 -2
  12. data/address-formatting/conf/abbreviations/en.yaml +1 -1
  13. data/address-formatting/conf/abbreviations/fr.yaml +1 -1
  14. data/address-formatting/conf/abbreviations/hu.yaml +1 -2
  15. data/address-formatting/conf/abbreviations/nl.yaml +14 -1
  16. data/address-formatting/conf/abbreviations/no.yaml +16 -0
  17. data/address-formatting/conf/abbreviations/pl.yaml +24 -0
  18. data/address-formatting/conf/abbreviations/pt.yaml +0 -1
  19. data/address-formatting/conf/abbreviations/ru.yaml +45 -0
  20. data/address-formatting/conf/abbreviations/uk.yaml +0 -3
  21. data/address-formatting/conf/abbreviations/vn.yaml +7 -0
  22. data/address-formatting/conf/components.yaml +23 -4
  23. data/address-formatting/conf/countries/worldwide.yaml +166 -122
  24. data/address-formatting/conf/country2lang.yaml +3 -3
  25. data/address-formatting/conf/county_codes.yaml +369 -15
  26. data/address-formatting/conf/state_codes.yaml +1324 -129
  27. data/address-formatting/testcases/countries/as.yaml +7 -8
  28. data/address-formatting/testcases/countries/be.yaml +35 -0
  29. data/address-formatting/testcases/countries/bf.yaml +15 -1
  30. data/address-formatting/testcases/countries/ca.yaml +29 -5
  31. data/address-formatting/testcases/countries/cn.yaml +9 -0
  32. data/address-formatting/testcases/countries/de.yaml +1 -1
  33. data/address-formatting/testcases/countries/fr.yaml +81 -1
  34. data/address-formatting/testcases/countries/gb.yaml +90 -8
  35. data/address-formatting/testcases/countries/gg.yaml +2 -1
  36. data/address-formatting/testcases/countries/gu.yaml +2 -2
  37. data/address-formatting/testcases/countries/hk.yaml +18 -8
  38. data/address-formatting/testcases/countries/hm.yaml +1 -0
  39. data/address-formatting/testcases/countries/ie.yaml +45 -3
  40. data/address-formatting/testcases/countries/im.yaml +2 -1
  41. data/address-formatting/testcases/countries/je.yaml +2 -1
  42. data/address-formatting/testcases/countries/no.yaml +17 -0
  43. data/address-formatting/testcases/countries/pt.yaml +22 -0
  44. data/address-formatting/testcases/countries/ru.yaml +30 -0
  45. data/address-formatting/testcases/countries/sg.yaml +18 -1
  46. data/address-formatting/testcases/countries/sh.yaml +2 -1
  47. data/address-formatting/testcases/countries/ug.yaml +13 -0
  48. data/address-formatting/testcases/countries/um.yaml +1 -1
  49. data/address-formatting/testcases/countries/us.yaml +69 -2
  50. data/address-formatting/testcases/other/xx.yaml +28 -0
  51. data/address_composer.gemspec +4 -4
  52. data/lib/address_composer.rb +10 -9
  53. data/lib/address_composer/version.rb +1 -1
  54. metadata +24 -19
  55. data/.ruby-version +0 -1
@@ -7,15 +7,14 @@ components:
7
7
  building: Executive Office Building (American Samoa Government)
8
8
  country: American Samoa
9
9
  country_code: as
10
- county: Ituau
10
+ county: Eastern District
11
+ municipality: Maʻopūtasi County
11
12
  postcode: 96799
12
- road: Route 001
13
- village: Faganeanea
13
+ road: Route 118
14
+ village: Utulei
14
15
  expected: |
15
16
  Executive Office Building (American Samoa Government)
16
- Route 001
17
- Faganeanea, AS 96799
17
+ Route 118
18
+ Utulei
19
+ Maʻopūtasi County, AS 96799
18
20
  United States of America
19
-
20
-
21
-
@@ -18,3 +18,38 @@ expected: |
18
18
  Vrijheidstraat 63
19
19
  2000 Antwerp
20
20
  Belgium
21
+ ---
22
+ description: prefer municipality over hamlet, 50.5689247, 5.3918483
23
+ components:
24
+ country: België
25
+ country_code: be
26
+ county: Huy
27
+ hamlet: Clermont-sous-Huy
28
+ house_number: 187
29
+ municipality: Engis
30
+ postcode: 4480
31
+ region: Wallonia
32
+ road: Chaussée de Liège
33
+ state: Liège
34
+ expected: |
35
+ Chaussée de Liège 187
36
+ 4480 Engis
37
+ België
38
+ ---
39
+ description: prefer village over municipality 50.84201, 4.11871
40
+ components:
41
+ country: Belgium
42
+ country_code: be
43
+ county: Halle-Vilvoorde
44
+ municipality: Roosdaal
45
+ postcode: 1760
46
+ region: Flanders
47
+ road: Kerkveldstraat
48
+ state: Flemish Brabant
49
+ village: Strijtem
50
+ expected: |
51
+ Kerkveldstraat
52
+ 1760 Strijtem
53
+ Belgium
54
+
55
+
@@ -17,6 +17,20 @@ expected: |
17
17
  Avenue Nelson Mandela
18
18
  Ouagadougou
19
19
  Burkina Faso
20
-
20
+ ---
21
+ description: village, Bank in Ouagadougou, 10.5450,-4.5787
22
+ components:
23
+ country: Burkina Faso
24
+ country_code: bf
25
+ department: Tiéfora
26
+ province: Comoé
27
+ road: unnamed road
28
+ village: Bondorola
29
+ expected: |
30
+ unnamed road
31
+ Bondorola
32
+ Tiéfora
33
+ Comoé
34
+ Burkina Faso
21
35
 
22
36
 
@@ -65,8 +65,32 @@ expected: |
65
65
  McMurchy Avenue South
66
66
  Brampton, ON L6Y 1Z4
67
67
  Canada
68
-
69
-
70
-
71
-
72
-
68
+ ---
69
+ # 43.6666,-79.7482
70
+ description: just county
71
+ components:
72
+ country: Canada
73
+ country_code: ca
74
+ county: Springfield
75
+ state: Manitoba
76
+ expected: |
77
+ Springfield, MB
78
+ Canada
79
+ ---
80
+ # 43.60242, -79.80113
81
+ description: locality
82
+ components:
83
+ country: Canada
84
+ country_code: ca
85
+ county: Halton Region
86
+ house_number: 7931
87
+ locality: Halton Hills
88
+ municipality: Halton Hills
89
+ postcode: L5N 8P7
90
+ road: Tenth Line
91
+ state: Ontario
92
+ state_district: Golden Horseshoe
93
+ expected: |
94
+ 7931 Tenth Line
95
+ Halton Hills, ON L5N 8P7
96
+ Canada
@@ -18,6 +18,15 @@ expected: |
18
18
  Pudong New District
19
19
  200120 Shanghai
20
20
  China
21
+ ---
22
+ description: Macau
23
+ components:
24
+ country: China
25
+ country_code: cn
26
+ region: Macau
27
+ expected: |
28
+ Macau
29
+ China
21
30
 
22
31
 
23
32
 
@@ -182,7 +182,7 @@ components:
182
182
  country: Germany
183
183
  country_code: de
184
184
  county: Aschaffenburg
185
- postcode: 63739,63741,63743
185
+ postcode: '63739,63741,63743'
186
186
  road: Haselmühlweg
187
187
  state: Free State of Bavaria
188
188
  state_district: Lower Franconia
@@ -198,4 +198,84 @@ expected: |
198
198
  E 15
199
199
  77630 Arbonne-la-Forêt
200
200
  France
201
-
201
+ #
202
+ # town and municpality
203
+ #
204
+ ---
205
+ description: 43.42981,6.77514
206
+ components:
207
+ amenity: A1X4E0
208
+ country: France
209
+ country_code: fr
210
+ county: Var
211
+ municipality: Draguignan
212
+ postcode: 83700
213
+ road: Avenue du XVe Corps
214
+ state: Provence-Alpes-Côte dAzur
215
+ suburb: Valescure
216
+ town: Saint-Raphaël
217
+ expected: |
218
+ A1X4E0
219
+ Avenue du XVe Corps
220
+ 83700 Saint-Raphaël
221
+ France
222
+ #
223
+ # Paris, remove Arrondissement
224
+ #
225
+ ---
226
+ description: 48.8564, 2.2961
227
+ components:
228
+ city: Paris 7e Arrondissement
229
+ country: France
230
+ country_code: fr
231
+ house_number: 15
232
+ postcode: 75007
233
+ state: Île-de-France
234
+ state_district: Paris
235
+ street: Avenue Charles Floquet
236
+ expected: |
237
+ 15 Avenue Charles Floquet
238
+ 75007 Paris
239
+ France
240
+ #
241
+ # village and municpality
242
+ #
243
+ ---
244
+ description: 45.08523,5.73302
245
+ components:
246
+ country: France
247
+ country_code: fr
248
+ county: Isère
249
+ house_number: 83
250
+ municipality: Grenoble
251
+ neighbourhood: Lotissement des cartonneries
252
+ postcode: 38560
253
+ road: Avenue Jean Navarre
254
+ state: Auvergne-Rhône-Alpes
255
+ state_code: ARA
256
+ village: Champ-sur-Drac
257
+ expected: |
258
+ 83 Avenue Jean Navarre
259
+ 38560 Champ-sur-Drac
260
+ France
261
+ #
262
+ # hamlet and town
263
+ #
264
+ ---
265
+ description: 7.06073496297967,6.60534772183623
266
+ components:
267
+ country: France
268
+ country_code: fr
269
+ county: Doubs
270
+ hamlet: Les Communaux
271
+ house_number: 20
272
+ municipality: Pontarlier
273
+ postcode: 25500
274
+ road: Rue Antoine de Roche
275
+ state: Bourgogne-Franche-Comté
276
+ state_code: BFC
277
+ town: Morteau
278
+ expected: |
279
+ 20 Rue Antoine de Roche
280
+ 25500 Morteau
281
+ France
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  description: Lokku office
3
3
  components:
4
- city: London Borough of Islington
4
+ city: London
5
+ city_district: London Borough of Islington
5
6
  country: United Kingdom
6
7
  country_code: GB
7
- county: London
8
8
  house: Lokku Ltd
9
9
  house_number: 82
10
10
  postcode: EC1M 5RF
@@ -15,7 +15,8 @@ components:
15
15
  expected: |
16
16
  Lokku Ltd
17
17
  82 Clerkenwell Road
18
- London EC1M 5RF
18
+ London
19
+ EC1M 5RF
19
20
  United Kingdom
20
21
 
21
22
  ---
@@ -29,6 +30,7 @@ components:
29
30
  suburb: Barbican
30
31
  expected: |
31
32
  Barbican
33
+ City of London
32
34
  London
33
35
  United Kingdom
34
36
 
@@ -62,7 +64,8 @@ expected: |
62
64
  ---
63
65
  description: just a suburb
64
66
  components:
65
- city: London Borough of Islington
67
+ city: London
68
+ city_district: London Borough of Islington
66
69
  country: United Kingdom
67
70
  country_code: gb
68
71
  county: London
@@ -91,7 +94,8 @@ components:
91
94
  expected: |
92
95
  University of Westminster
93
96
  115 New Cavendish Street
94
- London W1T 5DU
97
+ London
98
+ W1T 5DU
95
99
  United Kingdom
96
100
  ---
97
101
  description: village in Cambridgeshire, 52.281523,-0.115179
@@ -106,7 +110,28 @@ components:
106
110
  town: Huntingdonshire
107
111
  village: Hilton
108
112
  expected: |
109
- Hilton PE28 9QA
113
+ Hilton
114
+ PE28 9QA
115
+ United Kingdom
116
+ ---
117
+ description: Willoughby House, Barbican
118
+ components:
119
+ building: Willoughby House
120
+ city: London
121
+ country: United Kingdom
122
+ country_code: gb
123
+ county: City of London
124
+ postcode: EC2Y 9DP
125
+ quarter: Barbican
126
+ road: Moor Lane
127
+ state: England
128
+ state_district: Greater London
129
+ expected: |
130
+ Willoughby House
131
+ Moor Lane
132
+ Barbican
133
+ London
134
+ EC2Y 9DP
110
135
  United Kingdom
111
136
  ---
112
137
  description: City of Nottingham
@@ -123,7 +148,8 @@ components:
123
148
  suburb: St Ann's
124
149
  expected: |
125
150
  121 Abbotsford Drive
126
- Nottingham NG3 1NB
151
+ Nottingham
152
+ NG3 1NB
127
153
  United Kingdom
128
154
  ---
129
155
  description: London Borough of Waltham Forest
@@ -141,7 +167,63 @@ components:
141
167
  suburb: Leyton
142
168
  expected: |
143
169
  64 Melbourne Road
144
- London E10
170
+ London
171
+ E10
172
+ United Kingdom
173
+ ---
174
+ description: London Borough of Waltham Forest - partial_postcode
175
+ components:
176
+ city: London
177
+ country: United Kingdom
178
+ country_code: gb
179
+ county: London Borough of Waltham Forest
180
+ house_number: 64
181
+ neighbourhood: Walthamstow Village
182
+ partial_postcode: E10
183
+ road: Melbourne Road
184
+ state: England
185
+ state_district: Greater London
186
+ suburb: Leyton
187
+ expected: |
188
+ 64 Melbourne Road
189
+ London
190
+ E10
191
+ United Kingdom
192
+ ---
193
+ description: Prefer town over city (Ossett vs Wakefield)
194
+ components:
195
+ building: Orchard House
196
+ city: Wakefield
197
+ country: United Kingdom
198
+ country_code: gb
199
+ county: West Yorkshire
200
+ postcode: WF5 8PG
201
+ road: West Wells Road
202
+ state: England
203
+ state_code: ENG
204
+ state_district: Yorkshire and the Humber
205
+ town: Ossett
206
+ expected: |
207
+ Orchard House
208
+ West Wells Road
209
+ Ossett
210
+ WF5 8PG
211
+ United Kingdom
212
+ ---
213
+ description: Farmland
214
+ components:
215
+ country: United Kingdom
216
+ country_code: gb
217
+ county: York
218
+ farmland: Fair Field
219
+ hamlet: Kexby
220
+ state: England
221
+ state_district: Yorkshire and the Humber
222
+ expected: |
223
+ Fair Field
224
+ Kexby
225
+ York
226
+ England
145
227
  United Kingdom
146
228
 
147
229
 
@@ -12,7 +12,8 @@ components:
12
12
  expected: |
13
13
  Post Office
14
14
  Le Marchant Street
15
- Saint Peter Port GY1
15
+ Saint Peter Port
16
+ GY1
16
17
  Guernsey, Channel Islands
17
18
 
18
19
 
@@ -1,15 +1,15 @@
1
1
  # Guam, unincorporated territory of the US
2
2
  ---
3
- description: House in Tamuning
3
+ description: House in Tamuning, 13.50294,144.77693
4
4
  components:
5
5
  country: Guam
6
6
  country_code: gu
7
7
  county: Guam
8
8
  house_number: 258
9
- locality: Tamuning
10
9
  postcode: 96913
11
10
  road: Father San Vitores Street
12
11
  state: Guam
12
+ town: Tamuning
13
13
  expected: |
14
14
  258 Father San Vitores Street
15
15
  Tamuning, GU 96913
@@ -2,19 +2,29 @@
2
2
  ---
3
3
  description: Cinema in HK, 22.29987,114.17933
4
4
  components:
5
- cinema: Chinachem Golden Plaza Cinema
6
- country: Hong Kong
7
- country_code: hk
8
- county: Yau Tsim Mong District
9
- road: Science Museum Road
10
- state: Hong Kong
11
- state_district: Kowloon
12
- suburb: Tsim Sha Tsui
5
+ cinema: Chinachem Golden Plaza Cinema
6
+ country: Hong Kong
7
+ country_code: hk
8
+ county: Yau Tsim Mong District
9
+ road: Science Museum Road
10
+ state: Hong Kong
11
+ state_district: Kowloon
12
+ suburb: Tsim Sha Tsui
13
13
  expected: |
14
14
  Chinachem Golden Plaza Cinema
15
15
  Science Museum Road
16
16
  Kowloon
17
17
  Hong Kong
18
+ ---
19
+ description: just city, no state
20
+ components:
21
+ city: Hong Kong
22
+ country: Hong Kong
23
+ country_code: hk
24
+ road: 211 Test Street
25
+ expected: |
26
+ 211 Test Street
27
+ Hong Kong
18
28
 
19
29
 
20
30