1
0
Fork 0

try to clean more addresses

This commit is contained in:
Mateusz Konieczny 2024-10-21 12:41:18 +02:00
parent eda13885b0
commit b7fb805103
2 changed files with 13 additions and 0 deletions

View file

@ -39,6 +39,9 @@ def drop_extra_detail_blocking_nominatim(value):
# US, Wichita, 7700 East Kellogg Drive
# works
value = re.sub(r'(,|, |)unit .*', '', value, flags=re.IGNORECASE)
# Shop 3, 60 Bold Street
value = re.sub(r'Shop [^,]*,\s*', '', value, flags=re.IGNORECASE)
return value

10
test_nominatim.py Normal file
View file

@ -0,0 +1,10 @@
import unittest
import nominatim
class NominatimTests(unittest.TestCase):
def test_drop_shop_mention_from_street_address(self):
self.assertEqual(nominatim.drop_extra_detail_blocking_nominatim('Shop 3, 60 Bold Street'), '60 Bold Street')
def test_avoid_destroying_legit_street_name(self):
self.assertEqual(nominatim.drop_extra_detail_blocking_nominatim('60 Shopping Street'), '60 Shopping Street')