rosemariafontana commited on
Commit
678f47c
Β·
verified Β·
1 Parent(s): b6d1b68

changed elif order

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -41,15 +41,14 @@ def extract_features(tokens, labels):
41
 
42
  if label == 'LABEL_1':
43
  # Check for partial date fragments (like '12' or '/')
44
- if re.match(partial_date_pattern, token):
45
- print(f"Debug -- Potentially building date: Token Start {token} After Token")
46
- current_date += token # Append token to the current entity
47
-
48
- # If the accumulated entity matches a full date
49
- elif re.match(date_pattern, current_date):
50
  merged_entities.append((current_date, 'date'))
51
  print(f"Debug -- Complete date added: {token}")
52
  current_date = "" # Reset for next entity
 
 
 
 
53
  else:
54
  # No partial or completed patterns are detected, but it's still LABEL_1
55
  # If there were any accumulated data so far
 
41
 
42
  if label == 'LABEL_1':
43
  # Check for partial date fragments (like '12' or '/')
44
+ if re.match(date_pattern, current_date):
 
 
 
 
 
45
  merged_entities.append((current_date, 'date'))
46
  print(f"Debug -- Complete date added: {token}")
47
  current_date = "" # Reset for next entity
48
+ # If the accumulated entity matches a full date
49
+ elif re.match(partial_date_pattern, token):
50
+ print(f"Debug -- Potentially building date: Token Start {token} After Token")
51
+ current_date += token # Append token to the current entity
52
  else:
53
  # No partial or completed patterns are detected, but it's still LABEL_1
54
  # If there were any accumulated data so far