Spaces:
Build error
Build error
File size: 701 Bytes
7bbae49 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
from extract_country.country_validator import extract_country_name
def country_extractor(ocr_list):
try:
country_found = False
country = None
result_string = ' '.join(string for string in ocr_list)
words = result_string.split()
for index,word in enumerate(words):
country_found, country_name = extract_country_name(word)
if country_found:
country_found = True
country = country_name
break
return country_found, country, ocr_list
except Exception as e:
print("[Exception in country_extractor ] ", str(e))
return country_found, country, ocr_list |