Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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))
|