scrapinghub / scrapinghub/dateparser

search_date not parsing date due to certain keywords/number present in text

Open
#921 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

search_dates
Dominant language
Python
Stars
2.9k
Forks
520
Avg merge
22h 56m
Merged PRs (30d)
6

Description

While running the following script i don't get any date returned:

search_dates("11 sent 12-Dec-2014")
output: None

but if the first digit is any number < 9 or >12, would return the correct date "12-Dec-2014"

search_dates("09 sent 12-Dec-2014")
output: [('12-Dec-2014', datetime.datetime(2014, 12, 12, 0, 0))]

search_dates("13 sent 12-Dec-2014")
output: [('12-Dec-2014', datetime.datetime(2014, 12, 12, 0, 0))]

I have tried using "parsers = [parser for parser in default_parsers if parser != 'relative-time']" in search_date, still the same

May i know if this is a bug, or if i'm doing something wrong?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported search_dates examples, especially the input beginning with 11, and inspect how the parser list handles the surrounding keyword and number. Done means the date 12-Dec-2014 is returned consistently for the failing case, with regression coverage for the contrasting inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.