scrapinghub / scrapinghub/dateparser

search_dates cannot find complete date

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

Nobody has claimed this yet.

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

Description

This simple example

text = 'Il giorno martedì 23 aprile 2019'

for chunk, date in search_dates(text, languages=['it'], settings={'DATE_ORDER': 'DMY'}):
        print(chunk)

prints three separate chunks:

martedì
aprile
2019

none of which is a complete date. For some reason it fails to recognize martedì 23 aprile 2019 as a single chunk. Removing Il giorno (the day) from the beginning of the sentence makes it parse correctly for some reason

Running on Mac OSX with

bash-3.2$ LOCALE
LANG="it_IT.UTF-8"
LC_COLLATE="it_IT.UTF-8"
LC_CTYPE="it_IT.UTF-8"
LC_MESSAGES="it_IT.UTF-8"
LC_MONETARY="it_IT.UTF-8"
LC_NUMERIC="it_IT.UTF-8"
LC_TIME="it_IT.UTF-8"
LC_ALL=

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 shown search_dates call with the Italian text and DATE_ORDER set to DMY. Trace the date-language parsing path responsible for combining the weekday, day, month, and year; done means the complete phrase is returned as one date chunk without breaking the existing example.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.