scrapinghub / scrapinghub/dateparser
[QUESTION] Can search_dates be used to find matches involving two times?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 520
- Avg merge
- 22h 56m
- Merged PRs (30d)
- 6
Description
Hello,
First of all, thank you for creating such a nifty general-purpose date/time parser!
I have some texts where the events are defined over two times, e.g. something like
text = "On Monday, December 9 from 10:00 to 15:00 we will deploy FizzBuzzAI to prod"
Currently search_dates is working well at capturing the date, but only returns times for the remainder, i.e.
from dateparser.search import search_dates
search_dates(text)
# output
[('On Monday, December 9', datetime.datetime(2020, 12, 9, 0, 0)),
('10:00', datetime.datetime(2020, 12, 9, 10, 0)),
('15:00', datetime.datetime(2020, 12, 9, 15, 0))]
What I would like to get as output is two events, one for the start / end of the time period:
event 1: datetime.datetime(2020, 12, 9, 10, 0)
event 2: datetime.datetime(2020, 12, 9, 15, 0)
I can achieve this with some post-processing, but I am curious whether this can be done directly in dateparser?
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 with the dateparser.search.search_dates entry point and reproduce the two-time example from the issue. Determine whether search_dates can represent a start and end time directly; done means documenting the supported behavior or defining the required range-handling change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100