nouamanetazi HF staff jerpint commited on
Commit
b089cf8
1 Parent(s): 8aff50f

update-regex-latlong-parsing (#25)

Browse files

- update regex (7351f679c79d9c844585c1d111aef1b444d900ec)


Co-authored-by: Jeremy Pinto <jerpint@users.noreply.huggingface.co>

Files changed (1) hide show
  1. src/utils.py +2 -2
src/utils.py CHANGED
@@ -65,8 +65,8 @@ def parse_latlng(latlng):
65
  if re.match(r"\(\d+\.\d+,\s?-\d+\.\d+\)", latlng):
66
  lat, lng = latlng[1:-1].split(",")
67
  return [float(lat), float(lng)]
68
- # check of it matches 30.9529832, -7.1010705 or 30.9529832,-7.1010705
69
- elif re.match(r"\d+\.\d+,\s?-\d+\.\d+", latlng):
70
  lat, lng = latlng.split(",")
71
  return [float(lat), float(lng)]
72
  # check if it matches 30,9529832, -7,1010705 or 30,9529832,-7,1010705, match1=30,9529832 and match2=-7,1010705
 
65
  if re.match(r"\(\d+\.\d+,\s?-\d+\.\d+\)", latlng):
66
  lat, lng = latlng[1:-1].split(",")
67
  return [float(lat), float(lng)]
68
+ # check of it matches 30.9529832, -7.1010705 or 30.9529832,-7.1010705 or 30.9529832 ,-7.10107050
69
+ elif re.match(r"\d+\.\d+\s?,\s?-\d+\.\d+", latlng):
70
  lat, lng = latlng.split(",")
71
  return [float(lat), float(lng)]
72
  # check if it matches 30,9529832, -7,1010705 or 30,9529832,-7,1010705, match1=30,9529832 and match2=-7,1010705