OCR / app /extract_identity_number /doc_number_extractor.py
ShahzainHaider's picture
Upload folder using huggingface_hub
7bbae49
raw
history blame
456 Bytes
import re
def doc_number(ocr_list):
try:
for item in ocr_list:
if (len(item) >= 6 and item[0].isnumeric() ) or (len(item) >= 6 and (item[0].isalpha() and item[1].isnumeric())):
print("DOCUMENT NUMBRE IS : ", item)
return True, item, ocr_list
return False, None, ocr_list
except Exception as e:
print("Exception in doc_number : " ,str(e))
return False, None, ocr_list