HornsAndHooves-indirizzo 0.1.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ module Indirizzo
2
+ class City
3
+ def self.city_parts(city)
4
+ strings = []
5
+ city.map do |string|
6
+ tokens = string.split(" ")
7
+ strings |= (0...tokens.length).to_a.reverse.map do |i|
8
+ (i...tokens.length).map {|j| tokens[i..j].join(" ")}
9
+ end.flatten
10
+ end
11
+ # Don't return strings that consist solely of abbreviations.
12
+ # NOTE: Is this a micro-optimization that has edge cases that will break?
13
+ # Answer: Yes, it breaks on "Prairie"
14
+ strings.reject { |s| Std_Abbr.key?(s) }.uniq
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,653 @@
1
+ # coding: utf-8
2
+ require 'set'
3
+ require 'indirizzo/numbers'
4
+
5
+ module Indirizzo
6
+ class Map < Hash
7
+ # The Map class provides a two-way mapping between postal abbreviations
8
+ # and their fully written equivalents.
9
+ #attr_accessor :partial
10
+ attr_accessor :regexp
11
+ def self.[] (*items)
12
+ hash = super(*items)
13
+ hash.build_match
14
+ hash.keys.each {|k| hash[k.downcase] = hash.fetch(k)}
15
+ hash.values.each {|v| hash[v.downcase] = v}
16
+ hash.freeze
17
+ end
18
+ def build_match
19
+ @regexp = Regexp.new(
20
+ '\b(' + [keys,values].flatten.join("|") + ')\b',
21
+ Regexp::IGNORECASE)
22
+ end
23
+ def key? (key)
24
+ super(key.downcase)
25
+ end
26
+ def [] (key)
27
+ super(key.downcase)
28
+ end
29
+ end
30
+
31
+ # The Directional constant maps compass direction words in English and
32
+ # Spanish to their 1- or 2- letter abbreviations. See 2008 TIGER/Line
33
+ # technical documentation Appendix C for more details.
34
+ Directional = Map[
35
+ "North" => "N",
36
+ "South" => "S",
37
+ "East" => "E",
38
+ "West" => "W",
39
+ "Northeast" => "NE",
40
+ "Northwest" => "NW",
41
+ "Southeast" => "SE",
42
+ "Southwest" => "SW",
43
+ "Norte" => "N",
44
+ "Sur" => "S",
45
+ "Este" => "E",
46
+ "Oeste" => "O",
47
+ "Noreste" => "NE",
48
+ "Noroeste" => "NO",
49
+ "Sudeste" => "SE",
50
+ "Sudoeste" => "SO"
51
+ ]
52
+
53
+ # The Prefix_Qualifier constant maps feature prefix qualifiers to their
54
+ # abbreviations. See 2008 TIGER/Line technical documentation Appendix D.
55
+ Prefix_Qualifier = Map[
56
+ "Alternate" => "Alt",
57
+ "Business" => "Bus",
58
+ "Bypass" => "Byp",
59
+ "Extended" => "Exd",
60
+ "Historic" => "Hst",
61
+ "Loop" => "Lp",
62
+ "Old" => "Old",
63
+ "Private" => "Pvt",
64
+ "Public" => "Pub",
65
+ "Spur" => "Spr",
66
+ ]
67
+
68
+ # The Suffix_Qualifier constant maps feature suffix qualifiers to their
69
+ # abbreviations. See 2008 TIGER/Line technical documentation Appendix D.
70
+ Suffix_Qualifier = Map[
71
+ "Access" => "Acc",
72
+ "Alternate" => "Alt",
73
+ "Business" => "Bus",
74
+ "Bypass" => "Byp",
75
+ "Connector" => "Con",
76
+ "Extended" => "Exd",
77
+ "Extension" => "Exn",
78
+ "Loop" => "Lp",
79
+ "Private" => "Pvt",
80
+ "Public" => "Pub",
81
+ "Scenic" => "Scn",
82
+ "Spur" => "Spr",
83
+ "Ramp" => "Rmp",
84
+ "Underpass" => "Unp",
85
+ "Overpass" => "Ovp",
86
+ ]
87
+
88
+ # The Prefix_Canonical constant maps canonical TIGER/Line street type
89
+ # prefixes to their abbreviations. This list is the subset of the list from
90
+ # 2008 TIGER/Line technical documentation Appendix E that was extracted from
91
+ # a TIGER/Line database import.
92
+ Prefix_Canonical = {
93
+ "Arcade" => "Arc",
94
+ "Autopista" => "Autopista",
95
+ "Avenida" => "Ave",
96
+ "Avenue" => "Ave",
97
+ "Boulevard" => "Blvd",
98
+ "Bulevar" => "Bulevar",
99
+ "Bureau of Indian Affairs Highway" => "BIA Hwy",
100
+ "Bureau of Indian Affairs Road" => "BIA Rd",
101
+ "Bureau of Indian Affairs Route" => "BIA Rte",
102
+ "Bureau of Land Management Road" => "BLM Rd",
103
+ "Bypass" => "Byp",
104
+ "Calle" => "Cll",
105
+ "Calleja" => "Calleja",
106
+ "Callejón" => "Callejón",
107
+ "Caminito" => "Cmt",
108
+ "Camino" => "Cam",
109
+ "Carretera" => "Carr",
110
+ "Cerrada" => "Cer",
111
+ "Círculo" => "Cír",
112
+ "Commons" => "Cmns",
113
+ "Corte" => "Corte",
114
+ "County Highway" => "Co Hwy",
115
+ "County Lane" => "Co Ln",
116
+ "County Road" => "Co Rd",
117
+ "County Route" => "Co Rte",
118
+ "County State Aid Highway" => "Co St Aid Hwy",
119
+ "County Trunk Highway" => "Co Trunk Hwy",
120
+ "County Trunk Road" => "Co Trunk Rd",
121
+ "Court" => "Ct",
122
+ "Delta Road" => "Delta Rd",
123
+ "District of Columbia Highway" => "DC Hwy",
124
+ "Driveway" => "Driveway",
125
+ "Entrada" => "Ent",
126
+ "Expreso" => "Expreso",
127
+ "Expressway" => "Expy",
128
+ "Farm Road" => "Farm Rd",
129
+ "Farm-to-Market Road" => "FM",
130
+ "Fire Control Road" => "Fire Cntrl Rd",
131
+ "Fire District Road" => "Fire Dist Rd",
132
+ "Fire Lane" => "Fire Ln",
133
+ "Fire Road" => "Fire Rd",
134
+ "Fire Route" => "Fire Rte",
135
+ "Fire Trail" => "Fire Trl",
136
+ "Forest Highway" => "Forest Hwy",
137
+ "Forest Road" => "Forest Rd",
138
+ "Forest Route" => "Forest Rte",
139
+ "Forest Service Road" => "FS Rd",
140
+ "Highway" => "Hwy",
141
+ "Indian Route" => "Indian Rte",
142
+ "Indian Service Route" => "Indian Svc Rte",
143
+ "Interstate Highway" => "I-",
144
+ "Lane" => "Ln",
145
+ "Logging Road" => "Logging Rd",
146
+ "Loop" => "Loop",
147
+ "National Forest Development Road" => "Nat For Dev Rd",
148
+ "Navajo Service Route" => "Navajo Svc Rte",
149
+ "Parish Road" => "Parish Rd",
150
+ "Pasaje" => "Pasaje",
151
+ "Paseo" => "Pso",
152
+ "Passage" => "Psge",
153
+ "Placita" => "Pla",
154
+ "Plaza" => "Plz",
155
+ "Point" => "Pt",
156
+ "Puente" => "Puente",
157
+ "Ranch Road" => "Ranch Rd",
158
+ "Ranch to Market Road" => "RM",
159
+ "Reservation Highway" => "Resvn Hwy",
160
+ "Road" => "Rd",
161
+ "Route" => "Rte",
162
+ "Row" => "Row",
163
+ "Rue" => "Rue",
164
+ "Ruta" => "Ruta",
165
+ "Sector" => "Sec",
166
+ "Sendero" => "Sendero",
167
+ "Service Road" => "Svc Rd",
168
+ "Skyway" => "Skwy",
169
+ "Square" => "Sq",
170
+ "State Forest Service Road" => "St FS Rd",
171
+ "State Highway" => "State Hwy",
172
+ "State Loop" => "State Loop",
173
+ "State Road" => "State Rd",
174
+ "State Route" => "State Rte",
175
+ "State Spur" => "State Spur",
176
+ "State Trunk Highway" => "St Trunk Hwy",
177
+ "Terrace" => "Ter",
178
+ "Town Highway" => "Town Hwy",
179
+ "Town Road" => "Town Rd",
180
+ "Township Highway" => "Twp Hwy",
181
+ "Township Road" => "Twp Rd",
182
+ "Trail" => "Trl",
183
+ "Tribal Road" => "Tribal Rd",
184
+ "Tunnel" => "Tunl",
185
+ "US Forest Service Highway" => "USFS Hwy",
186
+ "US Forest Service Road" => "USFS Rd",
187
+ "US Highway" => "US Hwy",
188
+ "US Route" => "US Rte",
189
+ "Vereda" => "Ver",
190
+ "Via" => "Via",
191
+ "Vista" => "Vis",
192
+ }
193
+
194
+ # The Prefix_Alternate constant maps alternate prefix street types to
195
+ # their canonical abbreviations. This list was merged in from the USPS
196
+ # list at http://www.usps.com/ncsc/lookups/abbr_suffix.txt.
197
+ Prefix_Alternate = {
198
+ "Av" => "Ave",
199
+ "Aven" => "Ave",
200
+ "Avenu" => "Ave",
201
+ "Avenue" => "Ave",
202
+ "Avn" => "Ave",
203
+ "Avnue" => "Ave",
204
+ "Boul" => "Blvd",
205
+ "Boulv" => "Blvd",
206
+ "Bypa" => "Byp",
207
+ "Bypas" => "Byp",
208
+ "Byps" => "Byp",
209
+ "Crt" => "Ct",
210
+ "Exp" => "Expy",
211
+ "Expr" => "Expy",
212
+ "Express" => "Expy",
213
+ "Expw" => "Expy",
214
+ "Highwy" => "Hwy",
215
+ "Hiway" => "Hwy",
216
+ "Hiwy" => "Hwy",
217
+ "Hway" => "Hwy",
218
+ #"La" => "Ln", # causes problems with Spanglish place names
219
+ "Lanes" => "Ln",
220
+ "Loops" => "Loop",
221
+ "Plza" => "Plz",
222
+ "Sqr" => "Sq",
223
+ "Sqre" => "Sq",
224
+ "Squ" => "Sq",
225
+ "Terr" => "Ter",
226
+ "Tr" => "Trl",
227
+ "Trails" => "Trl",
228
+ "Trls" => "Trl",
229
+ "Tunel" => "Tunl",
230
+ "Tunls" => "Tunl",
231
+ "Tunnels" => "Tunl",
232
+ "Tunnl" => "Tunl",
233
+ "Vdct" => "Via",
234
+ "Viadct" => "Via",
235
+ "Viaduct" => "Via",
236
+ "Vist" => "Vis",
237
+ "Vst" => "Vis",
238
+ "Vsta" => "Vis"
239
+ }
240
+
241
+ # The Prefix_Type constant merges the canonical prefix type abbreviations
242
+ # with their USPS accepted alternates.
243
+ Prefix_Type = Map[ Prefix_Canonical.merge(Prefix_Alternate) ]
244
+
245
+ # The Suffix_Canonical constant maps canonical TIGER/Line street type
246
+ # suffixes to their abbreviations. This list is the subset of the list from
247
+ # 2008 TIGER/Line technical documentation Appendix E that was extracted from
248
+ # a TIGER/Line database import.
249
+ Suffix_Canonical = {
250
+ "Alley" => "Aly",
251
+ "Arcade" => "Arc",
252
+ "Avenida" => "Ave",
253
+ "Avenue" => "Ave",
254
+ "Beltway" => "Beltway",
255
+ "Boulevard" => "Blvd",
256
+ "Bridge" => "Brg",
257
+ "Bypass" => "Byp",
258
+ "Causeway" => "Cswy",
259
+ "Circle" => "Cir",
260
+ "Common" => "Cmn",
261
+ "Commons" => "Cmns",
262
+ "Corners" => "Cors",
263
+ "Court" => "Ct",
264
+ "Courts" => "Cts",
265
+ "Crescent" => "Cres",
266
+ "Crest" => "Crst",
267
+ "Crossing" => "Xing",
268
+ "Cutoff" => "Cutoff",
269
+ "Drive" => "Dr",
270
+ "Driveway" => "Driveway",
271
+ "Esplanade" => "Esplanade",
272
+ "Estates" => "Ests",
273
+ "Expressway" => "Expy",
274
+ "Forest Highway" => "Forest Hwy",
275
+ "Fork" => "Frk",
276
+ "Four-Wheel Drive Trail" => "4WD Trl",
277
+ "Freeway" => "Fwy",
278
+ "Grade" => "Grade",
279
+ "Heights" => "Hts",
280
+ "Highway" => "Hwy",
281
+ "Jeep Trail" => "Jeep Trl",
282
+ "Landing" => "Lndg",
283
+ "Lane" => "Ln",
284
+ "Logging Road" => "Logging Rd",
285
+ "Loop" => "Loop",
286
+ "Motorway" => "Mtwy",
287
+ "Oval" => "Oval",
288
+ "Overpass" => "Opas",
289
+ "Parkway" => "Pkwy",
290
+ "Pass" => "Pass",
291
+ "Passage" => "Psge",
292
+ "Path" => "Path",
293
+ "Pike" => "Pike",
294
+ "Place" => "Pl",
295
+ "Plaza" => "Plz",
296
+ "Point" => "Pt",
297
+ "Pointe" => "Pointe",
298
+ "Promenade" => "Promenade",
299
+ "Railroad" => "RR",
300
+ "Railway" => "Rlwy",
301
+ "Ramp" => "Ramp",
302
+ "River" => "Riv",
303
+ "Road" => "Rd",
304
+ "Roadway" => "Roadway",
305
+ "Route" => "Rte",
306
+ "Row" => "Row",
307
+ "Rue" => "Rue",
308
+ "Service Road" => "Svc Rd",
309
+ "Skyway" => "Skwy",
310
+ "Spur" => "Spur",
311
+ "Square" => "Sq",
312
+ "Stravenue" => "Stra",
313
+ "Street" => "St",
314
+ "Strip" => "Strip",
315
+ "Terrace" => "Ter",
316
+ "Thoroughfare" => "Thoroughfare",
317
+ "Tollway" => "Tollway",
318
+ "Trace" => "Trce",
319
+ "Trafficway" => "Trfy",
320
+ "Trail" => "Trl",
321
+ "Trolley" => "Trolley",
322
+ "Truck Trail" => "Truck Trl",
323
+ "Tunnel" => "Tunl",
324
+ "Turnpike" => "Tpke",
325
+ "Viaduct" => "Viaduct",
326
+ "View" => "Vw",
327
+ "Vista" => "Vis",
328
+ "Walk" => "Walk",
329
+ "Walkway" => "Walkway",
330
+ "Way" => "Way",
331
+ }
332
+
333
+ # The Suffix_Alternate constant maps alternate suffix street types to
334
+ # their canonical abbreviations. This list was merged in from the USPS
335
+ # list at http://www.usps.com/ncsc/lookups/abbr_suffix.txt.
336
+ Suffix_Alternate = {
337
+ "Allee" => "Aly",
338
+ "Ally" => "Aly",
339
+ "Av" => "Ave",
340
+ "Aven" => "Ave",
341
+ "Avenu" => "Ave",
342
+ "Avenue" => "Ave",
343
+ "Avn" => "Ave",
344
+ "Avnue" => "Ave",
345
+ "Boul" => "Blvd",
346
+ "Boulv" => "Blvd",
347
+ "Brdge" => "Brg",
348
+ "Bypa" => "Byp",
349
+ "Bypas" => "Byp",
350
+ "Byps" => "Byp",
351
+ "Causway" => "Cswy",
352
+ "Circ" => "Cir",
353
+ "Circl" => "Cir",
354
+ "Crcl" => "Cir",
355
+ "Crcle" => "Cir",
356
+ "Crecent" => "Cres",
357
+ "Cresent" => "Cres",
358
+ "Crscnt" => "Cres",
359
+ "Crsent" => "Cres",
360
+ "Crsnt" => "Cres",
361
+ "Crssing" => "Xing",
362
+ "Crssng" => "Xing",
363
+ "Crt" => "Ct",
364
+ "Driv" => "Dr",
365
+ "Drv" => "Dr",
366
+ "Exp" => "Expy",
367
+ "Expr" => "Expy",
368
+ "Express" => "Expy",
369
+ "Expw" => "Expy",
370
+ "Freewy" => "Fwy",
371
+ "Frway" => "Fwy",
372
+ "Frwy" => "Fwy",
373
+ "Height" => "Hts",
374
+ "Hgts" => "Hts",
375
+ "Highwy" => "Hwy",
376
+ "Hiway" => "Hwy",
377
+ "Hiwy" => "Hwy",
378
+ "Ht" => "Hts",
379
+ "Hway" => "Hwy",
380
+ "La" => "Ln",
381
+ "Lanes" => "Ln",
382
+ "Lndng" => "Lndg",
383
+ "Loops" => "Loop",
384
+ "Ovl" => "Oval",
385
+ "Parkways" => "Pkwy",
386
+ "Parkwy" => "Pkwy",
387
+ "Paths" => "Path",
388
+ "Pikes" => "Pike",
389
+ "Pkway" => "Pkwy",
390
+ "Pkwys" => "Pkwy",
391
+ "Pky" => "Pkwy",
392
+ "Plza" => "Plz",
393
+ "Rivr" => "Riv",
394
+ "Rvr" => "Riv",
395
+ "Spurs" => "Spur",
396
+ "Sqr" => "Sq",
397
+ "Sqre" => "Sq",
398
+ "Squ" => "Sq",
399
+ "Str" => "St",
400
+ "Strav" => "Stra",
401
+ "Strave" => "Stra",
402
+ "Straven" => "Stra",
403
+ "Stravn" => "Stra",
404
+ "Strt" => "St",
405
+ "Strvn" => "Stra",
406
+ "Strvnue" => "Stra",
407
+ "Terr" => "Ter",
408
+ "Tpk" => "Tpke",
409
+ "Tr" => "Trl",
410
+ "Traces" => "Trce",
411
+ "Trails" => "Trl",
412
+ "Trls" => "Trl",
413
+ "Trnpk" => "Tpke",
414
+ "Trpk" => "Tpke",
415
+ "Tunel" => "Tunl",
416
+ "Tunls" => "Tunl",
417
+ "Tunnels" => "Tunl",
418
+ "Tunnl" => "Tunl",
419
+ "Turnpk" => "Tpke",
420
+ "Vist" => "Vis",
421
+ "Vst" => "Vis",
422
+ "Vsta" => "Vis",
423
+ "Walks" => "Walk",
424
+ "Wy" => "Way",
425
+ }
426
+
427
+ # The Suffix_Type constant merges the canonical suffix type abbreviations
428
+ # with their USPS accepted alternates.
429
+ Suffix_Type = Map[ Suffix_Canonical.merge(Suffix_Alternate) ]
430
+
431
+ # The Unit_Type constant lists acceptable USPS unit type abbreviations
432
+ # from http://www.usps.com/ncsc/lookups/abbr_sud.txt.
433
+ Unit_Type = Map[
434
+ "Apartment" => "Apt",
435
+ "Basement" => "Bsmt",
436
+ "Building" => "Bldg",
437
+ "Department"=> "Dept",
438
+ "Floor" => "Fl",
439
+ "Front" => "Frnt",
440
+ "Hangar" => "Hngr",
441
+ "Lobby" => "Lbby",
442
+ "Lot" => "Lot",
443
+ "Lower" => "Lowr",
444
+ "Office" => "Ofc",
445
+ "Penthouse" => "Ph",
446
+ "Pier" => "Pier",
447
+ "Rear" => "Rear",
448
+ "Room" => "Rm",
449
+ "Side" => "Side",
450
+ "Slip" => "Slip",
451
+ "Space" => "Spc",
452
+ "Stop" => "Stop",
453
+ "Suite" => "Ste",
454
+ "Trailer" => "Trlr",
455
+ "Unit" => "Unit",
456
+ "Upper" => "Uppr",
457
+ ]
458
+
459
+ Std_Abbr = Map[
460
+ [Directional, Prefix_Qualifier, Suffix_Qualifier,
461
+ Prefix_Type, Suffix_Type].inject({}) {|x,y|x.merge y}
462
+ ]
463
+
464
+ # The Name_Abbr constant maps common toponym abbreviations to their
465
+ # full word equivalents. This list was constructed partly by hand, and
466
+ # partly by matching USPS alternate abbreviations with feature names
467
+ # found in the TIGER/Line dataset.
468
+ Name_Abbr = Map[
469
+ "Av" => "Avenue",
470
+ "Ave" => "Avenue",
471
+ "Blvd" => "Boulevard",
472
+ "Bot" => "Bottom",
473
+ "Boul" => "Boulevard",
474
+ "Boulv" => "Boulevard",
475
+ "Br" => "Branch",
476
+ "Brg" => "Bridge",
477
+ "Canyn" => "Canyon",
478
+ "Cen" => "Center",
479
+ "Cent" => "Center",
480
+ "Cir" => "Circle",
481
+ "Circ" => "Circle",
482
+ "Ck" => "Creek",
483
+ "Cnter" => "Center",
484
+ "Cntr" => "Center",
485
+ "Cnyn" => "Canyon",
486
+ "Cor" => "Corner",
487
+ "Cors" => "Corners",
488
+ "Cp" => "Camp",
489
+ "Cr" => "Creek",
490
+ "Crcl" => "Circle",
491
+ "Crcle" => "Circle",
492
+ "Cres" => "Crescent",
493
+ "Crscnt" => "Crescent",
494
+ "Ct" => "Court",
495
+ "Ctr" => "Center",
496
+ "Cts" => "Courts",
497
+ "Cyn" => "Canyon",
498
+ "Div" => "Divide",
499
+ "Dr" => "Drive",
500
+ "Dv" => "Divide",
501
+ "Est" => "Estate",
502
+ "Ests" => "Estates",
503
+ "Ext" => "Extension",
504
+ "Extn" => "Extension",
505
+ "Extnsn" => "Extension",
506
+ "Forests" => "Forest",
507
+ "Forg" => "Forge",
508
+ "Frg" => "Forge",
509
+ "Ft" => "Fort",
510
+ "Gatewy" => "Gateway",
511
+ "Gdn" => "Garden",
512
+ "Gdns" => "Gardens",
513
+ "Gtwy" => "Gateway",
514
+ "Harb" => "Harbor",
515
+ "Hbr" => "Harbor",
516
+ "Height" => "Heights",
517
+ "Hgts" => "Heights",
518
+ "Highwy" => "Highway",
519
+ "Hiway" => "Highway",
520
+ "Hiwy" => "Highway",
521
+ "Holws" => "Hollow",
522
+ "Ht" => "Heights",
523
+ "Hway" => "Highway",
524
+ "Hwy" => "Highway",
525
+ "Is" => "Island",
526
+ "Iss" => "Islands",
527
+ "Jct" => "Junction",
528
+ "Jction" => "Junction",
529
+ "Jctn" => "Junction",
530
+ "Junctn" => "Junction",
531
+ "Juncton" => "Junction",
532
+ "Ldg" => "Lodge",
533
+ "Lgt" => "Light",
534
+ "Lndg" => "Landing",
535
+ "Lodg" => "Lodge",
536
+ "Loops" => "Loop",
537
+ "Mt" => "Mount",
538
+ "Mtin" => "Mountain",
539
+ "Mtn" => "Mountain",
540
+ "Orch" => "Orchard",
541
+ "Parkwy" => "Parkway",
542
+ "Pk" => "Park",
543
+ "Pkway" => "Parkway",
544
+ "Pkwy" => "Parkway",
545
+ "Pky" => "Parkway",
546
+ "Pl" => "Place",
547
+ "Pnes" => "Pines",
548
+ "Pr" => "Prairie",
549
+ "Prr" => "Prairie",
550
+ "Pt" => "Point",
551
+ "Pts" => "Points",
552
+ "Rdg" => "Ridge",
553
+ "Riv" => "River",
554
+ "Rnchs" => "Ranch",
555
+ "Spg" => "Spring",
556
+ "Spgs" => "Springs",
557
+ "Spng" => "Spring",
558
+ "Spngs" => "Springs",
559
+ "Sq" => "Square",
560
+ "Squ" => "Square",
561
+ # "St" => "Saint",
562
+ "Sta" => "Station",
563
+ "Statn" => "Station",
564
+ "Ste" => "Sainte",
565
+ "Stn" => "Station",
566
+ "Str" => "Street",
567
+ "Ter" => "Terrace",
568
+ "Terr" => "Terrace",
569
+ "Tpk" => "Turnpike",
570
+ "Tpke" => "Turnpike",
571
+ "Tr" => "Trail",
572
+ "Trls" => "Trail",
573
+ "Trpk" => "Turnpike",
574
+ "Tunls" => "Tunnel",
575
+ "Un" => "Union",
576
+ "Vill" => "Village",
577
+ "Villag" => "Village",
578
+ "Villg" => "Village",
579
+ "Vis" => "Vista",
580
+ "Vlg" => "Village",
581
+ "Vlgs" => "Villages",
582
+ "Wls" => "Wells",
583
+ "Wy" => "Way",
584
+ "Xing" => "Crossing",
585
+ ]
586
+
587
+ # The State constant maps US state and territory names to their 2-letter
588
+ # USPS abbreviations.
589
+ State = Map[
590
+ "Alabama" => "AL",
591
+ "Alaska" => "AK",
592
+ "American Samoa" => "AS",
593
+ "Arizona" => "AZ",
594
+ "Arkansas" => "AR",
595
+ "California" => "CA",
596
+ "Colorado" => "CO",
597
+ "Connecticut" => "CT",
598
+ "Delaware" => "DE",
599
+ "District of Columbia" => "DC",
600
+ "Washington DC" => "DC",
601
+ "Washington D.C." => "DC",
602
+ "Federated States of Micronesia" => "FM",
603
+ "Florida" => "FL",
604
+ "Georgia" => "GA",
605
+ "Guam" => "GU",
606
+ "Hawaii" => "HI",
607
+ "Idaho" => "ID",
608
+ "Illinois" => "IL",
609
+ "Indiana" => "IN",
610
+ "Iowa" => "IA",
611
+ "Kansas" => "KS",
612
+ "Kentucky" => "KY",
613
+ "Louisiana" => "LA",
614
+ "Maine" => "ME",
615
+ "Marshall Islands" => "MH",
616
+ "Maryland" => "MD",
617
+ "Massachusetts" => "MA",
618
+ "Michigan" => "MI",
619
+ "Minnesota" => "MN",
620
+ "Mississippi" => "MS",
621
+ "Missouri" => "MO",
622
+ "Montana" => "MT",
623
+ "Nebraska" => "NE",
624
+ "Nevada" => "NV",
625
+ "New Hampshire" => "NH",
626
+ "New Jersey" => "NJ",
627
+ "New Mexico" => "NM",
628
+ "New York" => "NY",
629
+ "North Carolina" => "NC",
630
+ "North Dakota" => "ND",
631
+ "Northern Mariana Islands" => "MP",
632
+ "Ohio" => "OH",
633
+ "Oklahoma" => "OK",
634
+ "Oregon" => "OR",
635
+ "Palau" => "PW",
636
+ "Pennsylvania" => "PA",
637
+ "Puerto Rico" => "PR",
638
+ "Rhode Island" => "RI",
639
+ "South Carolina" => "SC",
640
+ "South Dakota" => "SD",
641
+ "Tennessee" => "TN",
642
+ "Texas" => "TX",
643
+ "Utah" => "UT",
644
+ "Vermont" => "VT",
645
+ "Virgin Islands" => "VI",
646
+ "Virginia" => "VA",
647
+ "Washington" => "WA",
648
+ "West Virginia" => "WV",
649
+ "Wisconsin" => "WI",
650
+ "Wyoming" => "WY"
651
+ ]
652
+
653
+ end