scrapinghub / dateparser

python parser for human readable dates
BSD 3-Clause "New" or "Revised" License
2.57k stars 465 forks source link

seach_dates not working for 'next week' #1163

Open KalakondaKrish opened 1 year ago

KalakondaKrish commented 1 year ago

search_dates is not giving any datetime output for 'next week' and 'next day'. It is able to identify for 'next month', 'next year', 'next sunday', 'after one week'.

KalakondaKrish commented 1 year ago

It is also not working for after one week, it is giving before one week date. I have kept 'PREFER_DATES_FROM': 'future' as weel. Even though it is giving before one week date. text = I will call you after one week

[('one week', datetime.datetime(2023, 3, 28, 18, 23, 13, 704212))]
2023-03-28
18:23:13.704212
Gallaecio commented 1 year ago

Hmm…

>>> search_dates("next week")
>>> search_dates("next week", languages=["en"])
[('next week', datetime.datetime(2023, 4, 17, 13, 0, 32, 396222))]

I wonder if the issue is that “next week” is being detected as non-English.

When you know the language of the text you are passing, though, passing the language is recommended. Not only it will be more accurate, it will also be faster.