address_composer 0.1.1.pre → 0.1.2.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/README.md +1 -1
  4. data/address-formatting/.travis.yml +10 -0
  5. data/address-formatting/LICENSE.txt +21 -0
  6. data/address-formatting/README.md +153 -0
  7. data/address-formatting/bin/coverage.pl +120 -0
  8. data/address-formatting/bin/run_tests.t +62 -0
  9. data/address-formatting/conf/abbreviations/ca.yaml +4 -0
  10. data/address-formatting/conf/abbreviations/cs.yaml +7 -0
  11. data/address-formatting/conf/abbreviations/de.yaml +7 -0
  12. data/address-formatting/conf/abbreviations/dk.yaml +17 -0
  13. data/address-formatting/conf/abbreviations/en.yaml +31 -0
  14. data/address-formatting/conf/abbreviations/es.yaml +25 -0
  15. data/address-formatting/conf/abbreviations/et.yaml +9 -0
  16. data/address-formatting/conf/abbreviations/eu.yaml +5 -0
  17. data/address-formatting/conf/abbreviations/fi.yaml +19 -0
  18. data/address-formatting/conf/abbreviations/fr.yaml +10 -0
  19. data/address-formatting/conf/abbreviations/hu.yaml +4 -0
  20. data/address-formatting/conf/abbreviations/it.yaml +32 -0
  21. data/address-formatting/conf/abbreviations/nl.yaml +13 -0
  22. data/address-formatting/conf/abbreviations/pt.yaml +31 -0
  23. data/address-formatting/conf/abbreviations/ro.yaml +5 -0
  24. data/address-formatting/conf/abbreviations/se.yaml +16 -0
  25. data/address-formatting/conf/abbreviations/sk.yaml +22 -0
  26. data/address-formatting/conf/abbreviations/tr.yaml +12 -0
  27. data/address-formatting/conf/abbreviations/uk.yaml +11 -0
  28. data/address-formatting/conf/components.yaml +71 -0
  29. data/address-formatting/conf/countries/worldwide.yaml +1986 -0
  30. data/address-formatting/conf/country2lang.yaml +258 -0
  31. data/address-formatting/conf/country_codes.yaml +252 -0
  32. data/address-formatting/conf/county_codes.yaml +410 -0
  33. data/address-formatting/conf/state_codes.yaml +1498 -0
  34. data/address-formatting/opencage_logo_300_150.png +0 -0
  35. data/address-formatting/testcases/countries/ad.yaml +20 -0
  36. data/address-formatting/testcases/countries/ae.yaml +82 -0
  37. data/address-formatting/testcases/countries/af.yaml +19 -0
  38. data/address-formatting/testcases/countries/ag.yaml +18 -0
  39. data/address-formatting/testcases/countries/ai.yaml +19 -0
  40. data/address-formatting/testcases/countries/al.yaml +20 -0
  41. data/address-formatting/testcases/countries/am.yaml +18 -0
  42. data/address-formatting/testcases/countries/ao.yaml +22 -0
  43. data/address-formatting/testcases/countries/aq.yaml +18 -0
  44. data/address-formatting/testcases/countries/ar.yaml +23 -0
  45. data/address-formatting/testcases/countries/as.yaml +21 -0
  46. data/address-formatting/testcases/countries/at.yaml +17 -0
  47. data/address-formatting/testcases/countries/au.yaml +81 -0
  48. data/address-formatting/testcases/countries/aw.yaml +19 -0
  49. data/address-formatting/testcases/countries/ax.yaml +20 -0
  50. data/address-formatting/testcases/countries/az.yaml +21 -0
  51. data/address-formatting/testcases/countries/ba.yaml +23 -0
  52. data/address-formatting/testcases/countries/bb.yaml +20 -0
  53. data/address-formatting/testcases/countries/bd.yaml +23 -0
  54. data/address-formatting/testcases/countries/be.yaml +20 -0
  55. data/address-formatting/testcases/countries/bf.yaml +22 -0
  56. data/address-formatting/testcases/countries/bg.yaml +20 -0
  57. data/address-formatting/testcases/countries/bh.yaml +63 -0
  58. data/address-formatting/testcases/countries/bi.yaml +21 -0
  59. data/address-formatting/testcases/countries/bj.yaml +18 -0
  60. data/address-formatting/testcases/countries/bl.yaml +21 -0
  61. data/address-formatting/testcases/countries/bm.yaml +19 -0
  62. data/address-formatting/testcases/countries/bn.yaml +20 -0
  63. data/address-formatting/testcases/countries/bo.yaml +19 -0
  64. data/address-formatting/testcases/countries/bq.yaml +20 -0
  65. data/address-formatting/testcases/countries/br.yaml +62 -0
  66. data/address-formatting/testcases/countries/bs.yaml +19 -0
  67. data/address-formatting/testcases/countries/bt.yaml +19 -0
  68. data/address-formatting/testcases/countries/bv.yaml +11 -0
  69. data/address-formatting/testcases/countries/bw.yaml +17 -0
  70. data/address-formatting/testcases/countries/by.yaml +24 -0
  71. data/address-formatting/testcases/countries/bz.yaml +20 -0
  72. data/address-formatting/testcases/countries/ca.yaml +72 -0
  73. data/address-formatting/testcases/countries/cc.yaml +17 -0
  74. data/address-formatting/testcases/countries/cd.yaml +21 -0
  75. data/address-formatting/testcases/countries/cf.yaml +18 -0
  76. data/address-formatting/testcases/countries/cg.yaml +21 -0
  77. data/address-formatting/testcases/countries/ch.yaml +21 -0
  78. data/address-formatting/testcases/countries/ci.yaml +21 -0
  79. data/address-formatting/testcases/countries/ck.yaml +17 -0
  80. data/address-formatting/testcases/countries/cl.yaml +21 -0
  81. data/address-formatting/testcases/countries/cm.yaml +22 -0
  82. data/address-formatting/testcases/countries/cn.yaml +24 -0
  83. data/address-formatting/testcases/countries/co.yaml +18 -0
  84. data/address-formatting/testcases/countries/cr.yaml +21 -0
  85. data/address-formatting/testcases/countries/cu.yaml +22 -0
  86. data/address-formatting/testcases/countries/cv.yaml +22 -0
  87. data/address-formatting/testcases/countries/cw.yaml +21 -0
  88. data/address-formatting/testcases/countries/cx.yaml +19 -0
  89. data/address-formatting/testcases/countries/cy.yaml +21 -0
  90. data/address-formatting/testcases/countries/cz.yaml +20 -0
  91. data/address-formatting/testcases/countries/de.yaml +253 -0
  92. data/address-formatting/testcases/countries/dj.yaml +20 -0
  93. data/address-formatting/testcases/countries/dk.yaml +17 -0
  94. data/address-formatting/testcases/countries/dm.yaml +21 -0
  95. data/address-formatting/testcases/countries/do.yaml +24 -0
  96. data/address-formatting/testcases/countries/dz.yaml +20 -0
  97. data/address-formatting/testcases/countries/ec.yaml +23 -0
  98. data/address-formatting/testcases/countries/ee.yaml +19 -0
  99. data/address-formatting/testcases/countries/eg.yaml +88 -0
  100. data/address-formatting/testcases/countries/eh.yaml +22 -0
  101. data/address-formatting/testcases/countries/er.yaml +20 -0
  102. data/address-formatting/testcases/countries/es.yaml +44 -0
  103. data/address-formatting/testcases/countries/et.yaml +20 -0
  104. data/address-formatting/testcases/countries/fi.yaml +20 -0
  105. data/address-formatting/testcases/countries/fj.yaml +19 -0
  106. data/address-formatting/testcases/countries/fk.yaml +29 -0
  107. data/address-formatting/testcases/countries/fm.yaml +20 -0
  108. data/address-formatting/testcases/countries/fo.yaml +20 -0
  109. data/address-formatting/testcases/countries/fr.yaml +201 -0
  110. data/address-formatting/testcases/countries/ga.yaml +23 -0
  111. data/address-formatting/testcases/countries/gb.yaml +147 -0
  112. data/address-formatting/testcases/countries/gd.yaml +18 -0
  113. data/address-formatting/testcases/countries/ge.yaml +16 -0
  114. data/address-formatting/testcases/countries/gf.yaml +17 -0
  115. data/address-formatting/testcases/countries/gg.yaml +19 -0
  116. data/address-formatting/testcases/countries/gh.yaml +22 -0
  117. data/address-formatting/testcases/countries/gi.yaml +17 -0
  118. data/address-formatting/testcases/countries/gl.yaml +19 -0
  119. data/address-formatting/testcases/countries/gm.yaml +18 -0
  120. data/address-formatting/testcases/countries/gn.yaml +20 -0
  121. data/address-formatting/testcases/countries/gp.yaml +22 -0
  122. data/address-formatting/testcases/countries/gq.yaml +21 -0
  123. data/address-formatting/testcases/countries/gr.yaml +20 -0
  124. data/address-formatting/testcases/countries/gs.yaml +17 -0
  125. data/address-formatting/testcases/countries/gt.yaml +23 -0
  126. data/address-formatting/testcases/countries/gu.yaml +19 -0
  127. data/address-formatting/testcases/countries/gw.yaml +22 -0
  128. data/address-formatting/testcases/countries/gy.yaml +20 -0
  129. data/address-formatting/testcases/countries/hk.yaml +20 -0
  130. data/address-formatting/testcases/countries/hm.yaml +15 -0
  131. data/address-formatting/testcases/countries/hn.yaml +23 -0
  132. data/address-formatting/testcases/countries/hr.yaml +19 -0
  133. data/address-formatting/testcases/countries/ht.yaml +22 -0
  134. data/address-formatting/testcases/countries/hu.yaml +24 -0
  135. data/address-formatting/testcases/countries/id.yaml +19 -0
  136. data/address-formatting/testcases/countries/ie.yaml +67 -0
  137. data/address-formatting/testcases/countries/il.yaml +21 -0
  138. data/address-formatting/testcases/countries/im.yaml +19 -0
  139. data/address-formatting/testcases/countries/in.yaml +32 -0
  140. data/address-formatting/testcases/countries/io.yaml +16 -0
  141. data/address-formatting/testcases/countries/iq.yaml +94 -0
  142. data/address-formatting/testcases/countries/ir.yaml +19 -0
  143. data/address-formatting/testcases/countries/is.yaml +19 -0
  144. data/address-formatting/testcases/countries/it.yaml +48 -0
  145. data/address-formatting/testcases/countries/je.yaml +15 -0
  146. data/address-formatting/testcases/countries/jm.yaml +21 -0
  147. data/address-formatting/testcases/countries/jo.yaml +78 -0
  148. data/address-formatting/testcases/countries/jp.yaml +22 -0
  149. data/address-formatting/testcases/countries/ke.yaml +18 -0
  150. data/address-formatting/testcases/countries/kg.yaml +21 -0
  151. data/address-formatting/testcases/countries/kh.yaml +21 -0
  152. data/address-formatting/testcases/countries/ki.yaml +17 -0
  153. data/address-formatting/testcases/countries/km.yaml +18 -0
  154. data/address-formatting/testcases/countries/kn.yaml +18 -0
  155. data/address-formatting/testcases/countries/kp.yaml +21 -0
  156. data/address-formatting/testcases/countries/kr.yaml +21 -0
  157. data/address-formatting/testcases/countries/kw.yaml +69 -0
  158. data/address-formatting/testcases/countries/ky.yaml +21 -0
  159. data/address-formatting/testcases/countries/kz.yaml +19 -0
  160. data/address-formatting/testcases/countries/la.yaml +19 -0
  161. data/address-formatting/testcases/countries/lb.yaml +80 -0
  162. data/address-formatting/testcases/countries/lc.yaml +17 -0
  163. data/address-formatting/testcases/countries/li.yaml +18 -0
  164. data/address-formatting/testcases/countries/lk.yaml +23 -0
  165. data/address-formatting/testcases/countries/lr.yaml +22 -0
  166. data/address-formatting/testcases/countries/ls.yaml +19 -0
  167. data/address-formatting/testcases/countries/lt.yaml +17 -0
  168. data/address-formatting/testcases/countries/lu.yaml +22 -0
  169. data/address-formatting/testcases/countries/lv.yaml +17 -0
  170. data/address-formatting/testcases/countries/ly.yaml +77 -0
  171. data/address-formatting/testcases/countries/ma.yaml +18 -0
  172. data/address-formatting/testcases/countries/mc.yaml +20 -0
  173. data/address-formatting/testcases/countries/md.yaml +17 -0
  174. data/address-formatting/testcases/countries/me.yaml +19 -0
  175. data/address-formatting/testcases/countries/mf.yaml +20 -0
  176. data/address-formatting/testcases/countries/mg.yaml +21 -0
  177. data/address-formatting/testcases/countries/mh.yaml +19 -0
  178. data/address-formatting/testcases/countries/mk.yaml +21 -0
  179. data/address-formatting/testcases/countries/ml.yaml +22 -0
  180. data/address-formatting/testcases/countries/mm.yaml +20 -0
  181. data/address-formatting/testcases/countries/mn.yaml +20 -0
  182. data/address-formatting/testcases/countries/mo.yaml +23 -0
  183. data/address-formatting/testcases/countries/mp.yaml +20 -0
  184. data/address-formatting/testcases/countries/mq.yaml +21 -0
  185. data/address-formatting/testcases/countries/mr.yaml +58 -0
  186. data/address-formatting/testcases/countries/ms.yaml +19 -0
  187. data/address-formatting/testcases/countries/mt.yaml +16 -0
  188. data/address-formatting/testcases/countries/mu.yaml +21 -0
  189. data/address-formatting/testcases/countries/mv.yaml +20 -0
  190. data/address-formatting/testcases/countries/mw.yaml +20 -0
  191. data/address-formatting/testcases/countries/mx.yaml +22 -0
  192. data/address-formatting/testcases/countries/my.yaml +23 -0
  193. data/address-formatting/testcases/countries/mz.yaml +19 -0
  194. data/address-formatting/testcases/countries/na.yaml +20 -0
  195. data/address-formatting/testcases/countries/nc.yaml +22 -0
  196. data/address-formatting/testcases/countries/ne.yaml +24 -0
  197. data/address-formatting/testcases/countries/nf.yaml +16 -0
  198. data/address-formatting/testcases/countries/ng.yaml +21 -0
  199. data/address-formatting/testcases/countries/ni.yaml +28 -0
  200. data/address-formatting/testcases/countries/nl.yaml +79 -0
  201. data/address-formatting/testcases/countries/no.yaml +18 -0
  202. data/address-formatting/testcases/countries/np.yaml +25 -0
  203. data/address-formatting/testcases/countries/nr.yaml +17 -0
  204. data/address-formatting/testcases/countries/nu.yaml +17 -0
  205. data/address-formatting/testcases/countries/nz.yaml +18 -0
  206. data/address-formatting/testcases/countries/om.yaml +70 -0
  207. data/address-formatting/testcases/countries/pa.yaml +35 -0
  208. data/address-formatting/testcases/countries/pe.yaml +16 -0
  209. data/address-formatting/testcases/countries/pf.yaml +20 -0
  210. data/address-formatting/testcases/countries/pg.yaml +20 -0
  211. data/address-formatting/testcases/countries/ph.yaml +21 -0
  212. data/address-formatting/testcases/countries/pk.yaml +22 -0
  213. data/address-formatting/testcases/countries/pl.yaml +51 -0
  214. data/address-formatting/testcases/countries/pm.yaml +20 -0
  215. data/address-formatting/testcases/countries/pn.yaml +18 -0
  216. data/address-formatting/testcases/countries/pr.yaml +17 -0
  217. data/address-formatting/testcases/countries/ps.yaml +112 -0
  218. data/address-formatting/testcases/countries/pt.yaml +16 -0
  219. data/address-formatting/testcases/countries/pw.yaml +17 -0
  220. data/address-formatting/testcases/countries/py.yaml +20 -0
  221. data/address-formatting/testcases/countries/qa.yaml +46 -0
  222. data/address-formatting/testcases/countries/re.yaml +19 -0
  223. data/address-formatting/testcases/countries/ro.yaml +21 -0
  224. data/address-formatting/testcases/countries/rs.yaml +19 -0
  225. data/address-formatting/testcases/countries/ru.yaml +22 -0
  226. data/address-formatting/testcases/countries/rw.yaml +22 -0
  227. data/address-formatting/testcases/countries/sa.yaml +16 -0
  228. data/address-formatting/testcases/countries/sb.yaml +18 -0
  229. data/address-formatting/testcases/countries/sc.yaml +20 -0
  230. data/address-formatting/testcases/countries/sd.yaml +22 -0
  231. data/address-formatting/testcases/countries/se.yaml +38 -0
  232. data/address-formatting/testcases/countries/sg.yaml +26 -0
  233. data/address-formatting/testcases/countries/sh.yaml +34 -0
  234. data/address-formatting/testcases/countries/si.yaml +20 -0
  235. data/address-formatting/testcases/countries/sj.yaml +13 -0
  236. data/address-formatting/testcases/countries/sk.yaml +20 -0
  237. data/address-formatting/testcases/countries/sl.yaml +23 -0
  238. data/address-formatting/testcases/countries/sm.yaml +19 -0
  239. data/address-formatting/testcases/countries/sn.yaml +20 -0
  240. data/address-formatting/testcases/countries/so.yaml +23 -0
  241. data/address-formatting/testcases/countries/sr.yaml +20 -0
  242. data/address-formatting/testcases/countries/ss.yaml +19 -0
  243. data/address-formatting/testcases/countries/st.yaml +20 -0
  244. data/address-formatting/testcases/countries/sv.yaml +42 -0
  245. data/address-formatting/testcases/countries/sx.yaml +21 -0
  246. data/address-formatting/testcases/countries/sy.yaml +84 -0
  247. data/address-formatting/testcases/countries/sz.yaml +21 -0
  248. data/address-formatting/testcases/countries/tc.yaml +21 -0
  249. data/address-formatting/testcases/countries/td.yaml +19 -0
  250. data/address-formatting/testcases/countries/tf.yaml +18 -0
  251. data/address-formatting/testcases/countries/tg.yaml +20 -0
  252. data/address-formatting/testcases/countries/th.yaml +26 -0
  253. data/address-formatting/testcases/countries/tj.yaml +19 -0
  254. data/address-formatting/testcases/countries/tk.yaml +13 -0
  255. data/address-formatting/testcases/countries/tl.yaml +20 -0
  256. data/address-formatting/testcases/countries/tm.yaml +21 -0
  257. data/address-formatting/testcases/countries/tn.yaml +50 -0
  258. data/address-formatting/testcases/countries/to.yaml +20 -0
  259. data/address-formatting/testcases/countries/tr.yaml +18 -0
  260. data/address-formatting/testcases/countries/tt.yaml +18 -0
  261. data/address-formatting/testcases/countries/tv.yaml +17 -0
  262. data/address-formatting/testcases/countries/tw.yaml +22 -0
  263. data/address-formatting/testcases/countries/tz.yaml +65 -0
  264. data/address-formatting/testcases/countries/ua.yaml +19 -0
  265. data/address-formatting/testcases/countries/ug.yaml +23 -0
  266. data/address-formatting/testcases/countries/um.yaml +14 -0
  267. data/address-formatting/testcases/countries/us.yaml +185 -0
  268. data/address-formatting/testcases/countries/uy.yaml +21 -0
  269. data/address-formatting/testcases/countries/uz.yaml +19 -0
  270. data/address-formatting/testcases/countries/va.yaml +31 -0
  271. data/address-formatting/testcases/countries/vc.yaml +18 -0
  272. data/address-formatting/testcases/countries/ve.yaml +20 -0
  273. data/address-formatting/testcases/countries/vg.yaml +21 -0
  274. data/address-formatting/testcases/countries/vi.yaml +20 -0
  275. data/address-formatting/testcases/countries/vn.yaml +18 -0
  276. data/address-formatting/testcases/countries/vu.yaml +18 -0
  277. data/address-formatting/testcases/countries/wf.yaml +18 -0
  278. data/address-formatting/testcases/countries/ws.yaml +18 -0
  279. data/address-formatting/testcases/countries/ye.yaml +60 -0
  280. data/address-formatting/testcases/countries/yt.yaml +20 -0
  281. data/address-formatting/testcases/countries/za.yaml +22 -0
  282. data/address-formatting/testcases/countries/zm.yaml +20 -0
  283. data/address-formatting/testcases/countries/zw.yaml +20 -0
  284. data/address-formatting/testcases/other/null.yaml +9 -0
  285. data/address_composer.gemspec +2 -2
  286. data/lib/address_composer/version.rb +1 -1
  287. metadata +285 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5dc6f7150d8ff02dc9efb23da97a41bd3dd4b4bd
4
- data.tar.gz: 88e13e1d05454799ee6adaf4ea06e09095bbc5bd
3
+ metadata.gz: 1ff29a1fb1a5be6de0536d15665c65b35446cc59
4
+ data.tar.gz: 5aff1357c3033f2c68c05978317f23bbc72d9947
5
5
  SHA512:
6
- metadata.gz: a553c8298de626fb00d2590db4126d71394ba30c4db559adc520c547bde5c6508df06eedd25a0d1ccfefa35818d203c2a2545f574441d19e74d3e64974bf4e10
7
- data.tar.gz: 92e81fa2932ec9b88f145aa603a3e9def4c4a3d11b1984d1b62c832fb0bc02b34d990a76a38d33be8356ea0866c7a7bed652232fb722b8cd02545985b848b3e8
6
+ metadata.gz: 6ada0e4482655f7d0d0c8f9bb0d7755b10abd8e41e7b6c973e5c4ad3fc982a57268ad70f6520e11f1d4e9f22135cfd745ddc692f0e4167a437fdc2b79258dd41
7
+ data.tar.gz: 1d8f70916066338be173a8ffb3f6ab435280601303706880984a8100ddc14f8205903c1506ac0c4dfa405840e84189a783a553fe5a02572e0a0af56da7af39c4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- address_composer (0.1.0)
4
+ address_composer (0.1.1.pre)
5
5
  mustache (~> 1.1)
6
6
 
7
7
  GEM
@@ -18,7 +18,7 @@ GEM
18
18
  pry-byebug (3.9.0)
19
19
  byebug (~> 11.0)
20
20
  pry (~> 0.13.0)
21
- rake (10.5.0)
21
+ rake (13.0.1)
22
22
  rspec (3.9.0)
23
23
  rspec-core (~> 3.9.0)
24
24
  rspec-expectations (~> 3.9.0)
@@ -41,7 +41,7 @@ DEPENDENCIES
41
41
  bundler (~> 1.17)
42
42
  pry (~> 0.13)
43
43
  pry-byebug (~> 3.9)
44
- rake (~> 10.0)
44
+ rake (~> 13.0)
45
45
  rspec (~> 3.0)
46
46
 
47
47
  BUNDLED WITH
data/README.md CHANGED
@@ -54,7 +54,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
54
54
 
55
55
  ## Contributing
56
56
 
57
- Bug reports and pull requests are welcome on GitHub at https://github.com/mirubiri@gmail.com/address_composer.
57
+ Bug reports and pull requests are welcome on GitHub at https://github.com/mirubiri/address_composer
58
58
 
59
59
 
60
60
 
@@ -0,0 +1,10 @@
1
+ ---
2
+ language: 'perl'
3
+ perl:
4
+ - "5.26" # Ubuntu 18
5
+ env: PERL_CPANM_OPT="--notest --force --skip-satisfied"
6
+ install:
7
+ - cpanm File::Find::Rule~0.34
8
+ - cpanm Geo::Address::Formatter~1.76
9
+ script:
10
+ - bin/run_tests.t
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Opencage GmbH - https://opencagedata.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,153 @@
1
+ # address formatting
2
+
3
+ ### Overview
4
+
5
+ This project contains templates and test cases for address formats used in territories around the world. The templates can then be processed in any programming language ([see below for list of processors](#processing-logic)).
6
+
7
+ ### Build Status
8
+
9
+ [![Build Status](https://travis-ci.org/OpenCageData/address-formatting.svg?branch=master)](https://travis-ci.org/OpenCageData/address-formatting)
10
+
11
+ ### An example:
12
+
13
+ Given a set of address parts like
14
+
15
+ house_number: 17
16
+ road: Rue du Médecin-Colonel Calbairac
17
+ neighbourhood: Lafourguette
18
+ suburb: Toulouse Ouest
19
+ postcode: 31000
20
+ city: Toulouse
21
+ county: Toulouse
22
+ state: Midi-Pyrénées
23
+ country: France
24
+ country_code: FR
25
+
26
+ we want to write logic to compile an address in the format consumers expect
27
+
28
+ 17 Rue du Médecin-Colonel Calbairac
29
+ 31000 Toulouse
30
+ France
31
+
32
+ ### Why would you want to do this?
33
+
34
+ The intended use case is database or geocoding systems (forward, reverse, autocomplete) where we know both the country of the address and the language of the user/reader. The address is displayed to a consumer (for example in an app) and not used to print on an envelope for actual postal delivery. We use it to format output from the [OpenCage Geocoder](https://opencagedata.com).
35
+
36
+ ### Which addresses are we talking about?
37
+
38
+ We have to deal with
39
+
40
+ * incomplete data
41
+ * anything with a name (peaks, bridges, bus stops)
42
+
43
+ Unlike [physical post (office) mail](http://www.bitboost.com/ref/international-address-formats.html) we don't have to deal with
44
+
45
+ * apartment/flat number, floor numbers
46
+ * PO boxes
47
+ * translating the language of the (destination) address. Whatever language is input is output.
48
+
49
+ ### Processing logic
50
+
51
+ Our goal with this repository is a series of (programming) language independent templates. Those templates can then be processed by whatever software you like.
52
+
53
+ There are open-source implementations in
54
+
55
+ * [Javascript](https://github.com/fragaria/address-formatter)
56
+ * [Perl](https://metacpan.org/release/Geo-Address-Formatter)
57
+ * [PHP](https://github.com/predicthq/address-formatter-php)
58
+ * [Rust](https://github.com/CanalTP/address-formatter-rs)
59
+
60
+ We would love more language implementations. The more people who use the templates, the more likely bugs will be reported.
61
+ If you write a processor, please submit a pull request adding it to the list. Thanks.
62
+
63
+ ### International coverage
64
+
65
+ As of `Sun 17 Feb 2019` coverage is:
66
+
67
+ We are aware of 248 territories
68
+ We have tests for 248 (100%) territories
69
+ We have rules for 248 (100%) territories
70
+ 0 (0%) territories have neither rules nor tests
71
+
72
+ This output is generated by `bin/coverage.pl`
73
+
74
+ We need more language specific abbreviations. Please see `conf/abbreviations`. Pull requests wil lbe glaldy received.
75
+
76
+ A detailed breakdown of test and configuration coverage can be found by running `bin/coverage.pl -d`. A list of all known territories is in `conf/country_codes.yaml`
77
+
78
+ _Please note: the list is simple all officially assigned [ISO 3166-1 alpha-2 codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements), and is not a political statement on whether or not these territories are or are not or should or should not be political states._
79
+
80
+ ### File format
81
+
82
+ The files are in [YAML](http://yaml.org/) format. The templates are written in [Mustache](http://mustache.github.io/). Both formats are human readable, strict, solve escaping and support comments. YAML allows references (called "ankers") to avoid copy&paste, Mustache allows sub-templates (called "partials").
83
+
84
+ ### How to add your country/territory
85
+
86
+ 1. edit the .yaml testcase for the country/territory in `testcases/countries`. The file names correspond to the appropriate ISO 3166-1 alpha-2 code - see `conf/country_codes.yaml`
87
+ * a good way to get sample data is:
88
+ * find an addressed location (house, business, etc) in your
89
+ target territory in OpenStreetMap
90
+ * get the coordinates (lat, long) of the location
91
+ * put the coordinates into the [OpenCage Geocoder demo
92
+ page](https://opencagedata.com/demo)
93
+ * look at the resulting JSON in the *Raw Response* tab
94
+
95
+ 2. edit `conf/countries/worldwide.yaml`
96
+ * Possibly your country/territory uses an existing generic format as
97
+ defined at the top of the file. If so, great, just map you
98
+ country_code to the generic template. You may still want to add
99
+ clean up code (see the entry for `DE` as an example).
100
+ * If not you need to define a new generic rule set
101
+ * possibly you will need to define new state/region mappings in `conf/state_codes.yaml`
102
+
103
+ 3. to test you will now need to process the .yaml test via a processer
104
+ (see above) and ensure the input leads to the desired output.
105
+
106
+ If in doubt, please get in touch by submitting an issue.
107
+
108
+ ### Formatting rules
109
+
110
+ Currently we support the following formatting rules:
111
+
112
+ * `replace:` regex that operates on the input values, useful for removing bureaucratic cruft like "London Borough of ". Note if you define the regex starting with format _X=_, for example _city=_ it should operate only on values with that key
113
+ * `postformat_replace:` regex that operates on the final output
114
+ * `add_component:` with a value of the form `component=XXXX`
115
+ * `change_country:` change the country value of the input, useful for dependent territories. Can include a substitution like `$state` so that that component value is then inserted into the new country value. See `testcases/countries/sh.yaml` for an example.
116
+ * `use_country:` use the formating configuration of another country, useful for dependent territories to avoid duplicating configuration
117
+
118
+ ### The future
119
+
120
+ More tests! For every rule about addresses there are exceptions and edge cases to consider. More test cases are always needed.
121
+
122
+ Planned features:
123
+
124
+ * basic error checking, for example ignore things which obviously can not be postcodes
125
+ * define rules for postcode format specifically
126
+
127
+ We welcome your pull requests. Together we can address the world!
128
+
129
+ ### License
130
+
131
+ This project is licensed under the MIT License - see the [LICENSE.txt](LICENSE.txt) file for details
132
+
133
+ ### Further reading on the challenge of address
134
+
135
+ Here's [our blog post anouncing this project](https://blog.opencagedata.com/post/99059889253/good-looking-addresses-solving-the-berlin-berlin) and the motivations behind it.
136
+
137
+ You may enjoy Michael Tandy's [Falsehoods Programmers Believe about Addresses](http://www.mjt.me.uk/posts/falsehoods-programmers-believe-about-addresses/).
138
+
139
+ If it's actual address data you're after, check out [OpenStreetMap](https://www.openstreetmap.org) and [OpenAddresses](http://openaddresses.io/).
140
+
141
+ If you want to turn longitude, latitude into well formatted addresses or placenames, well that's what a geocoder does. Check out ours: [OpenCage Geocoder](https://opencagedata.com).
142
+
143
+ If all this convinces you that address are evil, please check out [what3words](http://what3words.com) which allows you to dispense with them entirely.
144
+
145
+ ### Who is OpenCage GmbH?
146
+
147
+ <a href="https://opencagedata.com"><img src="opencage_logo_300_150.png"></a>
148
+
149
+ We run the [OpenCage Geocoder](https://opencagedata.com). Learn more [about us](https://opencagedata.com/about).
150
+
151
+ We also run [Geomob](https://thegeomob.com), a series of regular meetups for location based service creators, where we do our best to highlight geoinnovation. If you like geo stuff, you will probably enjoy [the Geomob podcast](https://thegeomob.com/podcast/).
152
+
153
+
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/env perl
2
+ #
3
+ # scan the tests and templates and tell us which territories
4
+ # don't yet have rules and tests
5
+ #
6
+ use strict;
7
+ use warnings;
8
+ use utf8;
9
+ use feature "unicode_strings";
10
+
11
+ use Data::Dumper;
12
+ use Getopt::Long;
13
+ use File::Basename qw(dirname);
14
+
15
+ my $help = 0;
16
+ my $details = 0;
17
+ GetOptions (
18
+ 'details' => \$details,
19
+ 'help' => \$help,
20
+ ) or die "invalid options";
21
+
22
+ if ($help) {
23
+ usage();
24
+ exit(0);
25
+ }
26
+
27
+ # get the list of countries
28
+ my %countries;
29
+ my $country_file = dirname(__FILE__) . "/../conf/country_codes.yaml";
30
+ open my $FH, "<:encoding(UTF-8)", $country_file or die "unable to open $country_file $!";
31
+ while (my $line = <$FH>){
32
+ chomp($line);
33
+ if ($line =~ m/^(\w\w): \# (.*)$/){
34
+ $countries{$1} = $2;
35
+ }
36
+ }
37
+ close $FH;
38
+ my $total_countries = scalar(keys %countries);
39
+ print "We are aware of " . $total_countries . " territories \n";
40
+
41
+
42
+ # which countries have tests?
43
+ my $test_dir = dirname(__FILE__) . '/../testcases/countries';
44
+ opendir(my $dh, $test_dir) || die "Error: Couldn't opendir($test_dir): $!\n";
45
+ my @files = grep { -f "$test_dir/$_" } readdir($dh);
46
+ closedir($dh);
47
+
48
+ my %test_countries;
49
+ foreach my $f (sort @files){
50
+ $f =~ s/\.yaml//;
51
+ $f = uc($f);
52
+ $test_countries{$f} = 1;
53
+ }
54
+ my $test_countries = scalar(keys %test_countries);
55
+ my $test_perc = int(100 * $test_countries / $total_countries );
56
+ print "We have tests for " . $test_countries . ' ('
57
+ . $test_perc . '%) territories' . "\n";
58
+ if ($details){
59
+ print "We need tests for:\n";
60
+ foreach my $cc (sort keys %countries){
61
+ next if (defined($test_countries{$cc}));
62
+ print "\t" . $cc . "\t". $countries{$cc}. "\n";
63
+ }
64
+ }
65
+
66
+ # which countries have rules?
67
+ my $rules_file = dirname(__FILE__) . '/../conf/countries/worldwide.yaml';
68
+ open my $RFH, "<:encoding(UTF-8)", $rules_file or die "unable to open $rules_file $!";
69
+ my %rules;
70
+ while (my $line = <$RFH>){
71
+ chomp($line);
72
+ if ($line =~ m/^"?(\w\w)"?:\s*$/){
73
+ $rules{$1} = 1;
74
+ }
75
+ }
76
+ close $RFH;
77
+ my $rules_countries = scalar(keys %rules);
78
+ my $rules_perc = int(100 * $rules_countries / $total_countries );
79
+ print "We have rules for " . $rules_countries . ' ('
80
+ . $rules_perc . '%) territories' . "\n";
81
+
82
+ if ($details){
83
+ print "We need rules for:\n";
84
+ foreach my $cc (sort keys %countries){
85
+ next if (defined($rules{$cc}));
86
+ print "\t" . $cc . "\t". $countries{$cc}. "\n";
87
+ }
88
+ }
89
+
90
+ # find territories without rules or tests
91
+ my %neither;
92
+ foreach my $cc (sort keys %countries){
93
+ next if (defined($rules{$cc}));
94
+ next if (defined($test_countries{$cc}));
95
+ $neither{$cc} = 1;
96
+ }
97
+ my $neither_countries = scalar(keys %neither);
98
+ my $neither_perc = int(100 * $neither_countries / $total_countries );
99
+ print $neither_countries . ' (' . $neither_perc . '%) territories have neither rules nor tests' . "\n";
100
+ if ($details){
101
+ print "Territories with no test and no rules:\n";
102
+ foreach my $cc (sort keys %neither){
103
+ print "\t" . $cc . "\t". $countries{$cc}. "\n";
104
+ }
105
+ }
106
+
107
+
108
+ sub usage {
109
+ print "\tHow many territories have formatting rules and tests?\n";
110
+ print "\tBy default prints just a high level summary\n";
111
+ print "\tusage:\n";
112
+ print "\t\t no required parameters\n";
113
+ print "\n";
114
+ print "\t\t optional parameters:\n";
115
+ print "\t\t --detail\t print full list of countries missing rules and tests\n";
116
+ print "\t\t --help\t print this message \n";
117
+ print "\n";
118
+ }
119
+
120
+
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env perl
2
+
3
+ # copy of
4
+ # https://github.com/OpenCageData/perl-Geo-Address-Formatter/blob/master/t/unit/countries.t
5
+ # and runs in travis-CI (see .travis.yml)
6
+
7
+ use strict;
8
+ use lib 'perl/lib/perl5';
9
+ use File::Basename qw(basename dirname);
10
+ use File::Find::Rule;
11
+ use File::Spec;
12
+ use Test::Exception;
13
+ use Test::More;
14
+ use YAML::XS qw(LoadFile);
15
+
16
+ use utf8;
17
+ # nicer output for diag and failures, see
18
+ # http://perldoc.perl.org/Test/More.html#CAVEATS-and-NOTES
19
+ my $builder = Test::More->builder;
20
+ binmode $builder->output, ":utf8";
21
+ binmode $builder->failure_output, ":utf8";
22
+ binmode $builder->todo_output, ":utf8";
23
+
24
+
25
+ my $path = dirname(__FILE__) . '/../testcases';
26
+
27
+ my @files = File::Find::Rule->file()->name( '*.yaml' )->in( $path );
28
+
29
+ ok(scalar(@files), 'found at least one file');
30
+
31
+ my $CLASS = 'Geo::Address::Formatter';
32
+ use_ok($CLASS);
33
+
34
+ my $conf_path = dirname(__FILE__) . '/../conf';
35
+ my $GAF = $CLASS->new( conf_path => $conf_path );
36
+
37
+ sub _one_testcase {
38
+ my $country = shift;
39
+ my $rh_testcase = shift;
40
+ is(
41
+ $GAF->format_address($rh_testcase->{components}),
42
+ $rh_testcase->{expected},
43
+ $country . ' - ' . $rh_testcase->{description}
44
+ );
45
+ }
46
+
47
+ foreach my $filename (@files){
48
+ my $country = basename($filename);
49
+ $country =~ s/\.\w+$//; # us.yaml => us
50
+
51
+ my @a_testcases = ();
52
+ lives_ok {
53
+ @a_testcases = LoadFile($filename);
54
+ } "parsing file $filename";
55
+
56
+ foreach my $rh_testcase (@a_testcases){
57
+ _one_testcase($country, $rh_testcase);
58
+ }
59
+ }
60
+
61
+
62
+ done_testing();
@@ -0,0 +1,4 @@
1
+ road:
2
+ Carrer de: C
3
+ Rambla: Rbla
4
+
@@ -0,0 +1,7 @@
1
+ road:
2
+ Ulice: Ul
3
+ Třída: Tř
4
+ Náměstí: Nám
5
+
6
+
7
+
@@ -0,0 +1,7 @@
1
+ road:
2
+ Platz: Pl
3
+ Sankt: St
4
+ Straße: Str
5
+ Strasse: Str
6
+
7
+