scrapinghub / scrapinghub/dateparser

search_dates doesn't appear to respect settings

Open
#1,245 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I am using the below code and I am getting incorrect values returned:

from dateparser.search import search_dates

content = "Agreement shall be renewed through and including December 31, 2024 (the \"Renewal Term\"); and (b) after the Renewal Term, the Agreement shall continue thereafter until either party elects to terminate the Agreement by delivering written notice of termination to the other party at least 90 days before the desired effective date of such termination"

results = search_dates(
        content,
        # azure_text_input_data.response.response["content"],
        settings={"STRICT_PARSING": True, "REQUIRE_PARTS": ["day", "month", "year"]},
)

print(results)

My expectation is that only the date December 31, 2024 is returned, but when I run this I also get "90 days before" in the results. Is there something wrong in my code?

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 running the provided search_dates example and inspect the dateparser.search.search_dates entry point, focusing on how STRICT_PARSING and REQUIRE_PARTS are applied. Done means the example returns only “December 31, 2024” while preserving the expected handling of other date expressions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.