datefinder icon indicating copy to clipboard operation
datefinder copied to clipboard

Problems with strict parameter when set to True

Open juancotrino opened this issue 4 years ago • 6 comments

Hello. I'm trying to use this function 'datefinder.find_dates("P_CHIRPS.v2.0_mm-day-1_daily_2020.01.28.tif", source=True, strict=True)', the parameter strict is set to True cause otherwise the function will consider the '2.0' as a date (tried setting strict=False), but with strict=True I get nothing. Thanks for the help.

juancotrino avatar May 13 '20 04:05 juancotrino

Same. strict=True is returning nothing

alwhelan22 avatar Nov 17 '20 23:11 alwhelan22

PR https://github.com/akoumjian/datefinder/pull/109 should fix this.

hmoravec avatar Nov 22 '20 01:11 hmoravec

I ended up using dateparser library where the strict parsing works as expected.

hmoravec avatar Nov 22 '20 15:11 hmoravec

The dateparser library doesn't work with full strings such as My birthday is August 12, 1994, where this does. I just want to be able to use the strict parameter correctly

alwhelan22 avatar Nov 25 '20 15:11 alwhelan22

@alwhelan22 dateparser works with full strings.

hmoravec avatar Nov 25 '20 19:11 hmoravec

But it picks up false positives as well:

from dateparser.search import search_dates

search_dates("My birthday is August 12 1994, and then hers in 6 months", settings={'STRICT_PARSING': True})
[('August 12 1994, and', datetime.datetime(1994, 8, 12, 0, 0)),
 ('in 6 months', datetime.datetime(1995, 2, 12, 0, 0))]

alwhelan22 avatar Nov 30 '20 17:11 alwhelan22