Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Natural language support #48

Open
Nukesor opened this issue Apr 1, 2024 · 2 comments
Open

Natural language support #48

Nukesor opened this issue Apr 1, 2024 · 2 comments

Comments

@Nukesor
Copy link

Nukesor commented Apr 1, 2024

Hey @waltzofpearls,

I'm currently using chrono-english, which is a library similar to dateparser. The chrono-english maintainer is pretty inactive though and I was about to rewrite his library, when I stumbled upon your library 😁 .

I like your architectural approach and I wanted to ask you, whether you could imagine to merge a parser for natural language, such as 3 weeks ago, in 2 months and 2 days, friday at 12pm. I'm currently using this for pueue and would really like to continue using this.
There's however an issue with chrono-english and some backwards incompatible changes in chrono itself, which lead to compilation errors

My approach for this would be to use pest to create a parser for a well-known syntax.
I would create a new module for natural language parsing and a generic trait and a dedicated parser for the english language that implements said trait, so other languages may be added in the future. Those could also be gated behind features.

How do you feel about this? If you think this is worthwhile and that you want to continue maintaining this crate for the forseeable future, I would go ahead and start working on this.

Edit:
Current progress:
https://github.com/Nukesor/dateparser/tree/natural-language

@waltzofpearls
Copy link
Owner

Hey @Nukesor, thanks for reaching out and proposing the idea of adding natural language support, then volunteering to work on it.

That's brilliant. I once thought about that at some point, especially when I saw python's dateparser lib, which supports parsing relative dates like what you described.

I like your proposed approach: using a separate module, building the parser with pest, using a trait for extensibility, and possibly using the features gate.

Feel free to go ahead and make a changeset for your feature. This repo is still being maintained. It's not hyperactive at the moment, but I always want to focus back on this and iterate on the parsing mechanism to optimize for speed.

@Nukesor
Copy link
Author

Nukesor commented Jun 9, 2024

Heyo @waltzofpearls .

Turns out, there's a pretty nice and maintained drop-in replacement for chrono-english around named interim.

So, I won't work on this any longer as it perfectly fits my own needs for now :)

Feel free to close this issue. However, if you're still interested in such functionality, you could think about just using interim as well^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants