Spaces:
Runtime error
Runtime error
debugging
Browse files
app.py
CHANGED
|
@@ -23,20 +23,24 @@ def extract_features(tokens, labels):
|
|
| 23 |
merged_entities = []
|
| 24 |
current_date = ""
|
| 25 |
|
|
|
|
| 26 |
# Loop through tokens and labels
|
| 27 |
for token, label in zip(tokens, labels):
|
| 28 |
if label == 'LABEL_1':
|
| 29 |
# Date logic
|
| 30 |
if re.match(r"^\d{1,2}/$", token) or re.match(r"^\d{4}$", token):
|
|
|
|
| 31 |
current_date += token
|
| 32 |
|
| 33 |
# Date logic
|
| 34 |
if re.match(r"^\d{4}$", token) and current_date.count('/') == 2:
|
| 35 |
merged_entities.append(current_date)
|
|
|
|
| 36 |
current_date = ""
|
| 37 |
else:
|
| 38 |
if current_date:
|
| 39 |
merged_entities.append(current_date)
|
|
|
|
| 40 |
current_date = ""
|
| 41 |
merged_entities.append(token)
|
| 42 |
|
|
|
|
| 23 |
merged_entities = []
|
| 24 |
current_date = ""
|
| 25 |
|
| 26 |
+
print(f"Debug -- Potentially creating date")
|
| 27 |
# Loop through tokens and labels
|
| 28 |
for token, label in zip(tokens, labels):
|
| 29 |
if label == 'LABEL_1':
|
| 30 |
# Date logic
|
| 31 |
if re.match(r"^\d{1,2}/$", token) or re.match(r"^\d{4}$", token):
|
| 32 |
+
print(f"Debug -- Potentially building date: {token}")
|
| 33 |
current_date += token
|
| 34 |
|
| 35 |
# Date logic
|
| 36 |
if re.match(r"^\d{4}$", token) and current_date.count('/') == 2:
|
| 37 |
merged_entities.append(current_date)
|
| 38 |
+
print(f"Debug -- Added date 1: {curent_date}")
|
| 39 |
current_date = ""
|
| 40 |
else:
|
| 41 |
if current_date:
|
| 42 |
merged_entities.append(current_date)
|
| 43 |
+
print(f"Debug -- Added date 2: {current_date}")
|
| 44 |
current_date = ""
|
| 45 |
merged_entities.append(token)
|
| 46 |
|