scrapinghub / scrapinghub/dateparser

Mistake search_dates for ru language

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

Nobody has claimed this yet.

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

Description

Hello everyone!

I have an issue with the following example:

search_dates('через 2 часа', languages = ['ru'])    # через 2 часа = in 2 hours
output:  [('2 часа', datetime.datetime(2020, 6, 11, 8, 58, 34, 823410))]
should be: [('через 2 часа', datetime.datetime(2020, 6, 11, 12, 58, 34, 823410))]

The answer is supposed to be "2 hours from now (later)", but it returns "2 hours before now (earlier)".
The thing is, the sentance is exactly following the structure defined in dateparser/dateparser/data/date_translation_data/ru.py , so I'm confused why the error takes place.
I try to figure out the logic of the parser, and so far I understood that for languages other than english it's supposed to return 2 results: one for translated to english sentance, and the other - for the original sentance. Did I get it correctly?

How can it be fixed?
Thanks!

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 search_dates('через 2 часа', languages=['ru']) example and inspect dateparser/dateparser/data/date_translation_data/ru.py, which the report identifies as relevant. Trace how the Russian phrase is interpreted and add or update coverage for the expected future datetime; done means the full phrase returns the correct two-hours-later result.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.