scrapinghub / scrapinghub/dateparser
J, K, W, X, Y letters confuse the parser
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 520
- Avg merge
- 22h 56m
- Merged PRs (30d)
- 6
Description
When using search_dates, the following Italian date is correctly recognised as 10 February 2020, 15:00:
>>> search_dates('10 Febbraio 2020 15:00 ciao', add_detected_language=True, languages= ['it', 'en'], settings={'DATE_ORDER': 'DMY'})
[('10 Febbraio 2020 15:00', datetime.datetime(2020, 2, 10, 15, 0), 'it')]
However, the following is considered an English date and therefore parsed incorrectly:
>>> search_dates('10 Febbraio 2020 15:00 ciao moka', add_detected_language=True, languages= ['it', 'en'], settings={'DATE_ORDER': 'DMY'})
[('2020 15:00', datetime.datetime(2020, 8, 29, 15, 0), 'en')]
That happens whenever in the string appears one of the letters J, K, W, X, Y.
The parser assumes these letters ought not to be considered part of the Italian alphabet, but a large number of common Italian words have these letters, as for the Italian word moka.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing both Italian search_dates examples with add_detected_language=True, languages=['it', 'en'], and DATE_ORDER='DMY'. Trace the language-selection path used by search_dates, focusing on why words containing J, K, W, X, or Y select English. Done means the example containing “moka” remains recognized as the Italian date with the expected timestamp and language.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- localization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100