Commit
·
777f12c
1
Parent(s):
dae7a0c
Update helper.py
Browse files
helper.py
CHANGED
@@ -296,9 +296,10 @@ def identify_locations(sentence):
|
|
296 |
locations_dict[loc_type] = []
|
297 |
locations_dict[loc_type].append(location)
|
298 |
|
|
|
299 |
# conditions for multiple references
|
300 |
# it is mandatory that a country will exist
|
301 |
-
if
|
302 |
|
303 |
# if a city exists
|
304 |
if 'city' in locations_dict:
|
@@ -333,7 +334,7 @@ def identify_locations(sentence):
|
|
333 |
|
334 |
# error if no country is referred
|
335 |
else:
|
336 |
-
|
337 |
|
338 |
except:
|
339 |
# handle the exception if any errors occur while identifying a country/city
|
|
|
296 |
locations_dict[loc_type] = []
|
297 |
locations_dict[loc_type].append(location)
|
298 |
|
299 |
+
|
300 |
# conditions for multiple references
|
301 |
# it is mandatory that a country will exist
|
302 |
+
if 'country' in locations_dict:
|
303 |
|
304 |
# if a city exists
|
305 |
if 'city' in locations_dict:
|
|
|
334 |
|
335 |
# error if no country is referred
|
336 |
else:
|
337 |
+
return (0, "LOCATION", "no_country")
|
338 |
|
339 |
except:
|
340 |
# handle the exception if any errors occur while identifying a country/city
|