geomash 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/geomash/standardizer.rb +9 -2
- data/lib/geomash/version.rb +1 -1
- data/test/geomash_test.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b352aa88b7f74448b67dc9aa8bc1e0886483b48
|
4
|
+
data.tar.gz: 6b217b344779f407b08906f1bb250fcd35f086db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58b2714da28ec388c7b07e82ea2c51c40b1b2d9fbded27f54bd8f0521cc6561cd3e5115cbc4b370275a51692a18020c9a5a7f78fce04c796e69d3899d5b1513c
|
7
|
+
data.tar.gz: 881c889566bce33fdcba5109b9efef976f75409c9349ccdef41bc6fc09b0551d2bb6f33d8aa9bb7dd100a6789e95fdc90ab944e31a6d3cf7e2c7ad16c0ec6bdd
|
data/lib/geomash/standardizer.rb
CHANGED
@@ -116,7 +116,13 @@ module Geomash
|
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
-
|
119
|
+
temp_term = []
|
120
|
+
geo_term.split(',').each do |split_term|
|
121
|
+
temp_term << split_term.strip if split_term.present?
|
122
|
+
end
|
123
|
+
geo_term = temp_term.join(', ')
|
124
|
+
|
125
|
+
geo_term = geo_term.squeeze(',') #This may no longer bee needed wih th the above
|
120
126
|
|
121
127
|
return geo_term
|
122
128
|
end
|
@@ -188,7 +194,8 @@ module Geomash
|
|
188
194
|
|
189
195
|
#Keep original string if three parts at least or if there is a number in the term.
|
190
196
|
#TODO: Make this better!
|
191
|
-
|
197
|
+
#Note: Counties can cause this first length check to fail. For now, adding a check for county word but temporary solution...
|
198
|
+
if (term.split(',').length >= 4 && geo_hash[:neighborhood_part].blank?) || (term.split(',').length >= 3 && geo_hash[:neighborhood_part].blank? && !geo_hash[:original_term].match(/[Cc]ounty/)) || (term.split(',').length >= 2 && geo_hash[:city_part].blank?) || term.split(',').length >= 4 || term.match(/\d/).present?
|
192
199
|
return true
|
193
200
|
end
|
194
201
|
|
data/lib/geomash/version.rb
CHANGED
data/test/geomash_test.rb
CHANGED
@@ -17,9 +17,9 @@ class GeomashTest < ActiveSupport::TestCase
|
|
17
17
|
assert_equal nil, result[:neighborhood_part]
|
18
18
|
assert_equal nil, result[:street_part]
|
19
19
|
assert_equal '2049596', result[:tgn][:id] if Geomash::TGN.tgn_enabled == true
|
20
|
-
assert_equal
|
20
|
+
assert_equal false, result[:tgn][:original_string_differs] if Geomash::TGN.tgn_enabled == true
|
21
21
|
assert_equal '4933002', result[:geonames][:id] if Geomash::Geonames.geonames_username != '<username>'
|
22
|
-
assert_equal
|
22
|
+
assert_equal false, result[:geonames][:original_string_differs] if Geomash::Geonames.geonames_username != '<username>'
|
23
23
|
|
24
24
|
#Slight variation problem with neighborhood: 11. Bezirk (Vienna, Austria)--Biography
|
25
25
|
result = Geomash.parse('15. Bezirk (Rudolfsheim-Fünfhaus, Vienna, Austria)--Exhibitions', true)
|