
Natural language datetime parsing web API - progrium
http://www.timeapi.org/
======
fizx
Hey, you should use the date_range gem! (Shameless self-project pimping) Look
at some of the things it adds to chronic:

[http://github.com/fizx/date_range/blob/459812f091a67ce8d4b0e...](http://github.com/fizx/date_range/blob/459812f091a67ce8d4b0e737282f4712b9cdd59a/spec/date_range_spec.rb)

Edit: Oh, and you should add a batch api. Request latency will easily trump
parsing time.

But yeah, keep up the good work. I need to find/create a good open
web/api/scraping/big-data meetup, preferably in SF, not the valley.

------
byoung2
<http://www.timeapi.org/pdt/this+friday+at+lunchtime>

by design?

------
jwecker
First thing I tried was "today"

Got back an internal server error, and then got back 1pm tomorrow (even with
the correct timezone).

------
lucumo
As much as everyone hates PHP, this would've been some two lines in it, using
strtotime()

It's really one of the best functions in the language.
<http://nl2.php.net/manual/en/function.strtotime.php>

------
amoeba
Very cool. Noticed it doesn't always throw an error when it's sent nonsense:

<http://www.timeapi.org/pdt/first+firday+this+september>

Gave me the third Wednesday of this September.

------
tptacek
Uh...

    
    
        %w[ rubygems sinatra chronic ].each {|x| require x}
        get "/utc/:time" do |time|; Chronic.parse(time).to_s; end
    

(Also, Chronic is extremely slow).

~~~
pennig
You've pretty much got the idea.

~~~
nir
Nothing wrong with that. Can be useful for non-Ruby apps, for example. BTW. A
JSONP version could make usable from JavaScript..

~~~
tptacek
It's already usable from JS.

    
    
        $.get("/time-thingy/utc/" + whatever, function(date) { 
            alert("your UTC timestamp is " + date);
        });
    

Not to be snarky, though, but this seems pretty silly. What major web
framework doesn't have natural-language date parsing? There are BSD-licensed C
libraries that do it. Why remote that?

~~~
fizx
Pointers to the C libraries, please! (beyond GNU Getdate, which doesn't really
do this.)

~~~
tptacek
I went looking for the one CVS uses, found this:

<http://www.datejs.com/>

and stopped looking.

------
perezd
you should make one based off of my plugin smartmonth!

<http://github.com/perezd/smart_month/tree/master>

------
lucifer
<http://www.timeapi.org/pdt/7+hours+before+tomorrow+at+noon>
<http://www.timeapi.org/pdt/7+hours+before+noon+tomorrow>

~~~
amoeba
This is a problem with Chronic and not with the webapp. It looks like Chronic
doesn't understand the distinction between midnight and noon.

*Edit: Looks like a lot more is wrong with Chronic.

<http://www.timeapi.org/pdt/seven%20hours%20before%20tomorrow>

~~~
catch23
<http://www.presdo.com> has a much more powerful natural language time parser
(that system handles all the timezones in the world) but they don't have a
great api for extracting that info. It can't handle stuff like "seven hours
before tomorrow" but it can do more common phrases like "tomorrow after lunch"
or "day after tomorrow at 3pm"

~~~
joe_the_user
_day after tomorrow at 3pm_

Lol, even I would be thrown by that phrase... (a comma might help)

It's like SQL.

The problem with SQL isn't that simple SQL phrases are that different from
normal language _OR_ that complex SQL phrases break the rules of simple SQL
phrases.

The problem with SQL is that humans beings have a lot of trouble understanding
complex phrases that follow the most consistent possible rules followed by
simple phrases...

So clever NLP often just out-clevers itself communicating with us... (remember
SQL was originally intended to be a language usable by even non-programmers
and ended up being a language that even many programmers feared ... though I
have an unusual fondness for it).

