tjl8 commited on
Commit
5eeac4c
·
verified ·
1 Parent(s): 5a1cee9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -371,7 +371,10 @@ def extract_date_range(query):
371
  "january": 1, "february": 2, "march": 3, "april": 4, "may": 5, "june": 6,
372
  "july": 7, "august": 8, "september": 9, "october": 10, "november": 11, "december": 12
373
  }
374
- pattern = r"(?i)from\s+([a-zA-Z]+)\s+(\d{4})\s+(to|until)\s+([a-zA-Z]+)\s+(\d{4})"
 
 
 
375
  match = re.search(pattern, query)
376
  if match:
377
  start_month_str, start_year = match.group(1).lower(), int(match.group(2))
 
371
  "january": 1, "february": 2, "march": 3, "april": 4, "may": 5, "june": 6,
372
  "july": 7, "august": 8, "september": 9, "october": 10, "november": 11, "december": 12
373
  }
374
+ # pattern = r"(?i)from\s+([a-zA-Z]+)\s+(\d{4})\s+(to|until)\s+([a-zA-Z]+)\s+(\d{4})"
375
+ pattern = [
376
+ r"(?i)(from|between)?\s*([a-zA-Z]+)\s+(\d{4})\s*(to|through|and|-)\s*([a-zA-Z]+)\s+(\d{4})",
377
+ ]
378
  match = re.search(pattern, query)
379
  if match:
380
  start_month_str, start_year = match.group(1).lower(), int(match.group(2))