ical-org / ical.net

ical.NET - an open source iCal library for .NET
MIT License
784 stars 231 forks source link

Natural Language de/serialization #576

Open paviad opened 1 year ago

paviad commented 1 year ago

A very desirable feature of this library, and which exists in similar libraries in other languages (e.g. Typescript's Equivalent is the ability to serialize and deserialize to and from natural language, for example:

Every day at 10, 12 and 17 should deserialize into FREQ=DAILY;BYHOUR=10,12,17

and vice versa.

I think this should be implemented as a separate (and optional) NuGet package.

paviad commented 1 year ago

I also have made an Antlr4 parser - I think it is better, easier to reason about the parsing (and also to maintain/modify)

axunonb commented 5 hours ago

@minichma There are 2 different aspects mentioned:

  1. Natural language: Not a high priority feature, and should go into an extension package
  2. Replace Regex with a Parser: A valid point regarding performance, memory allocations, maintainability. At NCalc we're using Parlot - unfortunately no experience on my side.

How to deal with this issue?

minichma commented 4 hours ago

Ad 1) I'm really not the right one to comment on that as it is strongly tied to the future strategy of this project. At this time I feel that addressing existing issues would be a number one priority and is enough work for a while. So adding new features would not be too helpful for that as someone will have to work on it and, more notably, maintain it in the future. But this could also be maintained in a separate repo. @paviad would it be an option for you to publish this as an independent package in a separate repo?

Ad 2) Are we talking about a parser for the new feature (natural language) or for ical.net as a whole. @paviad I assume the first, right? Then its tied to 1. The ical.net parser seems to be rather stable, but if an alternative existed in the form of a PR, I would assume it would be welcome.

paviad commented 4 hours ago

Can I use the name Ical.Net.NaturalLanguage ?

axunonb commented 2 hours ago

@paviad The name would be fine - maybe a bit long. Sth. shorter like ICal.Net.Phrases...? This was a co-pilot suggestion :) If you like, we can create the repo under ical-org (GitHub organization) to strengthen the "brand" with you as maintainer or admin.

axunonb commented 2 hours ago

@minichma

I feel that addressing existing issues would be a number one priority and is enough work for a while

Fully agree

the future strategy of this project

Making ICal.Net the best in class for dot net - in terms of usability, performance and RFC compliance / compatibility

minichma commented 1 hour ago

Making ICal.Net the best in class for dot net - in terms of usability, performance and RFC compliance / compatibility

Great mission statement! Should be added to the readme.

philsayersCDS commented 1 hour ago

Maybe you could leverage this library for generating natural language from a cron expression: https://github.com/Humanizr/Humanizer

paviad commented 56 minutes ago

I have a complete NL solution, but we can talk about extending it to more grammars later.