Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -216,7 +216,7 @@ def fix_account_number(hdr):
|
|
| 216 |
if not hdr:
|
| 217 |
return hdr
|
| 218 |
# Step 1: inject account number if missing after label
|
| 219 |
-
if "Account Number:" in hdr and
|
| 220 |
match = re.search("[0-9]{5,}", hdr)
|
| 221 |
if match:
|
| 222 |
acct = match.group(0)
|
|
@@ -224,11 +224,12 @@ def fix_account_number(hdr):
|
|
| 224 |
# Step 2: remove leading number that is duplicated after Account Number:
|
| 225 |
# e.g. "000000731823008 JPMorgan ... Account Number: 000000731823008"
|
| 226 |
# -> "JPMorgan ... Account Number: 000000731823008"
|
| 227 |
-
acct_match = re.search("Account Number:
|
| 228 |
if acct_match:
|
| 229 |
acct = acct_match.group(1)
|
| 230 |
# If hdr starts with that same number, remove it from the start
|
| 231 |
-
|
|
|
|
| 232 |
return hdr
|
| 233 |
|
| 234 |
|
|
|
|
| 216 |
if not hdr:
|
| 217 |
return hdr
|
| 218 |
# Step 1: inject account number if missing after label
|
| 219 |
+
if "Account Number:" in hdr and "Account Number: " not in hdr:
|
| 220 |
match = re.search("[0-9]{5,}", hdr)
|
| 221 |
if match:
|
| 222 |
acct = match.group(0)
|
|
|
|
| 224 |
# Step 2: remove leading number that is duplicated after Account Number:
|
| 225 |
# e.g. "000000731823008 JPMorgan ... Account Number: 000000731823008"
|
| 226 |
# -> "JPMorgan ... Account Number: 000000731823008"
|
| 227 |
+
acct_match = re.search(r"Account Number: ([0-9]{5,})", hdr)
|
| 228 |
if acct_match:
|
| 229 |
acct = acct_match.group(1)
|
| 230 |
# If hdr starts with that same number, remove it from the start
|
| 231 |
+
if hdr.startswith(acct):
|
| 232 |
+
hdr = hdr[len(acct):].lstrip()
|
| 233 |
return hdr
|
| 234 |
|
| 235 |
|