0

I'm using the dateparser python package to search for dates in a string.

Following string provides unexpected result:

Input string:

Feb 12 SOME STRING TORO ON 508 . 50

Output result:

[('ON 508', datetime.datetime(1900, 1, 1, 5, 0, 8))]

Expected result:

None

Code:

from dateparser.search import search_dates

possible_dates = search_dates("Feb 12 SOME STRING TORO ON 508 . 50", languages=['en'], settings={'STRICT_PARSING': True})

for dt in possible_dates:
    print (dt)

Any ideas why is this happening and how to correct this?

I've looked into setting format (cannot do that in search_dates function).

martineau
  • 119,623
  • 25
  • 170
  • 301
codergal
  • 31
  • 1
  • 5

1 Answers1

0

It must be a bug from the dateparser version you were running.

Using dateparser 0.7.2:

>>> from dateparser.search import search_dates
>>> search_dates("Feb 12 SOME STRING TORO ON 508 . 50")
[('Feb 12', datetime.datetime(2019, 2, 12, 0, 0)), ('ON', datetime.datetime(2019, 2, 6, 0, 0)), ('508', datetime.datetime(1900, 1, 1, 5, 0, 8))]
Gallaecio
  • 3,620
  • 2
  • 25
  • 64