Chronic 0.3.0 Released: Improved Natural Language Date/Time Parsing
Tom Preston-Werner has pushed out version 0.3.0 of Chronic, the popular natural language date and time parsing library for Ruby. It's a significant release because the last was 0.2.3 back in July 2007! Grab it now with gem install chronic
Despite the long time between releases, Chronic hasn't gone without attention. It's been sitting on GitHub and attracting patches for years, but Tom (who's already pretty busy, y'know, running GitHub) has now decided to bundle it up and push it live.
What does 0.3.0 get you?
- Improved time-zone support
- Handles "on" in phrases like "10am on Saturday"
- Now ignores commas (which could throw it off before)
- Supports "weekend" and "weekday"
- Allows numeric timezone offsets (e.g. -0500)
- Support for seasons
- "a", "p", "am", and "pm" parsing
- The typical bugfixes and low level improvements
Chronic is basically a Ruby institution by now (I first posted about it in September 2006!) so check it out. But if you're still itching for other ways to work with dates and times, check out 3 New Date and Time Libraries for Rubyists from May 2010. Tickle is particular interesting as it allows you to parse natural language requests for recurring events rather than single times.
October 26, 2010 at 9:19 am
And non of the libraries support a way to parse other other languages than English. Not even a general approach to support more than one language, all rules are hard coded. :-(
October 27, 2010 at 6:02 am
Sounds like an excellent time to submit a patch.
JUST DO IT!
October 28, 2010 at 7:05 pm
Great to see a new version. I hope this fixes the daylight savings time bug.
November 3, 2010 at 7:41 am
@JustDoIt: Sounds for me more like a complete rewrite (= a new lib) than a patch.
November 4, 2010 at 6:05 pm
I did an experience with i18n of this (sweet) lib:
http://github.com/nofxx/chronic18n
November 5, 2010 at 11:17 am
@nofxx: Cool idea. But I think word wise translation doesn't work for all cases because different languages uses a different sentence construction. For example "3 years ago" is in German "vor 3 Jahren" (years = Jahren, ago = vor).
November 6, 2010 at 7:27 pm
@Jan: Yup, there's such problem in portuguese too, that's why it's a two step translate, first "high level" grammar with regex, then word replacement.
Would you help me implement/try/test german?
November 9, 2010 at 10:10 am
@nofxx: Sounds practicable: "translating the complete phrase to correct English and then call chronic".
Unfortunately my free time is *very* spare at the moment and the near future, so I can't help so much. But if you explain the approach in detail (for example with test cases for Portuguese or another language) I would look at it, to see if it works with German.
November 12, 2010 at 3:45 pm
Tom was joking about this Gem @ RubyConf yesterday. He asked for a show of hands from anybody who knew about our used Chronic (got a good laugh). He also commented on the fact his talk started @ 4:20.