scrapinghub / scrapinghub/dateparser

can't parse Korean datestring in specific cases

Open
#1,139 1 comment 1 reaction 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

Seems like parsing is being broken if the datestring contains year/month/day keywords in Korean(//).

print(dateparser.__version__)
>>> 1.1.7

print(dateparser.parse('2023년 2월 10일 오전 3시 30분', locales=['ko']))
>>> None
print(dateparser.parse('2000년 1월 1일 19:30', locales=['ko']))
>>> None
print(dateparser.parse('1970년 1월 1일', locales=['ko']))
>>> None
print(dateparser.parse('12월 31일', locales=['ko']))
>>> None

Other cases, including relative keywords, works fine.

print(dateparser.parse('2023-02-10 03:30', locales=['ko']))
>>> 2023-02-10 03:30:00
print(dateparser.parse('오늘', locales=['ko']))  # today
>>> 2023-02-07 13:47:01.837601
print(dateparser.parse('내일', locales=['ko']))  # tomorrow
>>> 2023-02-08 13:47:01.838223
print(dateparser.parse('3시간 전', locales=['ko']))  # 3 hours ago
>>> 2023-02-07 10:47:01.838705

Also tried DateDataParser but no luck.

print(dateparser.date.DateDataParser(locales=['ko']).get_date_data('2023년 2월 10일 오전 3시 30분'))
>>> DateData(date_obj=None, period='day', locale=None)

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 Python reproductions in the issue against dateparser 1.1.7, then trace the Korean locale parsing path used by dateparser.parse and DateDataParser. Done means the listed Korean year/month/day and time strings return parsed dates while the existing relative-keyword examples continue to work.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.