opentasks icon indicating copy to clipboard operation
opentasks copied to clipboard

[Feature Request] Smart date parsing

Open lilianchiassai opened this issue 7 years ago • 4 comments

Hello everyone,

I am just starting using the app. I migrated from Todoist, that has this feature : when creating a new task, the title is parsed and if any date is found the end-date field of the task is filled.

It allows the user to create complex tasks directly directly from the widget : generally I do not even open the app to create tasks. Example:

  • do the laundry tomorrow
  • ssl certificate renewal April 14 etc.

Could this (or something similar) become a feature of Open Task in the future ? Should I give implementing it a try even thought it would be my first time developing a feature for an app ? If so, are external libraries (such as Jcronic) welcome ? And, finally, do you think this feature could/should be extended to other fields ? For example:

  • Week-end with friend from February 12 to 15
  • Meeting at Starbucks
  • Develop new OpenTask feature All day
  • Code audit 45%

lilianchiassai avatar Jan 23 '19 16:01 lilianchiassai

Thanks for this request. I was planning to implement such a feature. Some time ago I played with dialogflow (formerly api.ai), which allows to implement this quite easily. The drawback is that the text processing is done on Google's servers which bears a lot of privacy issues.

Just parsing the title for a date shouldn't be too difficult. The challenge is to be able to distinguish between things like start and due dates and to support more languages than just English. Maybe something like Apache OpenNLP could be helpful but it seems to be quite large and complex. CoreNLP looks promising too but it's GPL licensed (check out their online demo: http://corenlp.run/)

I'd love to have such a feature to support as many fields as possible, ideally in combination with smart auto-completion (i.e. it suggests recently used/known locations when you type "at")

Using libraries is fine as long as they use a permissive license which is compatible with Apache 2. If it turns out that a GPL licensed library is by far best for the job, we may have to bundle this feature in a separate add-on app using some sort of plugin mechanism to provide it in OpenTasks.

dmfs avatar Jan 23 '19 21:01 dmfs

You are probably right : if you intend to implement this feature, you should not settle for a limited date only parsing and go with a feature that would support as many fields as possible.

If you give me two weeks or a month, I will look into Apache OpenNLP (from what I found, it be a great tool if only there were more languages...) and CoreNLP (it looks promising) and see what I can do. I will let you know.

lilianchiassai avatar Jan 24 '19 00:01 lilianchiassai

We can certainly approach this in an agile manner and start with date parsing only, and even with just one language. We should, however, make sure we don't have to start from scratch when we want to extend this feature.

dmfs avatar Jan 24 '19 15:01 dmfs

For anyone revisiting the date-only part of this request, I maintain DateParser Kotlin, an early MIT-licensed KMP adaptation of Alexey Orazov's date-parser. It parses date/time expressions offline with English and Russian rules; examples include tomorrow and in 5 hours. A caller can pass an explicit reference (Instant) and timeZone (TimeZone), which is useful when deciding how relative phrases should be anchored.

There is an important compatibility limit here: its Android target requires API 26+, while OpenTasks currently supports API 21+, so it is a reference for a modern-Android prototype, not a drop-in dependency for the current app. It also does not decide start-vs-due semantics, extract locations or percentages, or schedule alarms. Those pieces would need their own handling.

Version 0.1.0 is on Maven Central as io.github.alox1d:dateparser-kotlin:0.1.0; English docs and examples. The English grammar needs more real phrase feedback, so reports of unsupported or misread English examples would be welcome.

The simple do the laundry tomorrow example retains the task text in a fixed-clock check. Month-first dates such as April 14 and all the advanced range examples should not be assumed supported by this early release. If the date component is useful as a reference, a GitHub star would be appreciated.

Maven Central 0.1.0.

Alox1d avatar Oct 14 '26 17:10 Alox1d