crystal-community / crystal-libraries-needed

A list of libraries that are needed or wanted for the Crystal-Language
141 stars 4 forks source link

a NLP based date parser #81

Closed johnjansen closed 3 years ago

johnjansen commented 6 years ago

just like chronic for ruby https://github.com/mojombo/chronic

ghost commented 6 years ago

@johnjansen Will start working on it today.

straight-shoota commented 6 years ago

timer seems not like an optimal choice for naming a shard that's supposed to parse date-time data.

And please note that if you wan't this to be in any way useful, you should avoid introducing a custom Timer::Time class but use the stdlib's Time instead. I'm sure it can do everything you need and users should not have to convert between different date-time types.

johnjansen commented 6 years ago

@straight-shoota the plan was to do something unlike StdLib, and more like Chronic (Ruby) which is a pure Ruby natural language date parser.

stuff more like the following

Chronic.parse('tomorrow')
  #=> Mon Aug 28 12:00:00 PDT 2006

Chronic.parse('monday', :context => :past)
  #=> Mon Aug 21 12:00:00 PDT 2006

Chronic.parse('this tuesday 5:00')
  #=> Tue Aug 29 17:00:00 PDT 2006

Chronic.parse('this tuesday 5:00', :ambiguous_time_range => :none)
  #=> Tue Aug 29 05:00:00 PDT 2006
johnjansen commented 6 years ago

however i agree that timer is a bad name choice ;-)

ghost commented 6 years ago

@straight-shoota @johnjansen Any name suggestions?

straight-shoota commented 6 years ago

@johnjansen yeah, sure. But it shouldn't need its own implementation of a date-time data type. These parsing methods can just be built upon the stdlib Time type.

johnjansen commented 6 years ago

totally agreed @straight-shoota, i haven't actually looked at the code (ok so there aint much to see yet), too much on my plate right now

HCLarsen commented 6 years ago

For name, why not TimeParser? It's clear and straightforward.

johnjansen commented 6 years ago

or Parsley, why ... no reason at all ;)

ghost commented 6 years ago

Will choose one after I slept a few hours. I really apperciate this conversation.

HCLarsen commented 6 years ago

Just please don't call it chronic.cr. The drug connotations of the word chronic would make it hard for me to use the library without laughing.

johnjansen commented 6 years ago

@HCLarsen CrackTime ???

ghost commented 6 years ago

Decided to leave crystal so I won't develop the library any further and delete it. Sorry.

drujensen commented 6 years ago

Crystal will miss you. She is always here for you. And she will be waiting for you to realize what you have lost. But remember to apologize to her when you come to your senses. ;-)

carcinocron commented 3 years ago

I have a partial implementation of php's strtotime, which for some users might be enough.

https://github.com/iomcr/php-strtotime

If a specific format is not supported in my library, but exists in php's strtotime, then it might have a draft definition here: https://github.com/iomcr/php-strtotime/blob/master/src/Strtotime/format_parsers.cr which likely just needs someone familiar with the format to add a spec file for it and finish converting it from JS.

alexanderadam commented 3 years ago

It seems that @nanobowers migrated cronic:

https://github.com/nanobowers/cronic

So I guess this can be closed now? :thinking: