$.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?
I was thinking more as a web service, so JSONP is for cross site XHR.
I assume someone would not have a good NL date parser for their environment, or won't be able to run it for some reason, or would simply prefer Chronic.
A lot of stuff that seems pointless ends up being useful, and vice versa. Assuming it's on Heroku's free plan, it costs nothing to run forever, so why not? If it helps 10 people, it already beat most web pages.
The thing is that natural language processing can't be solved in pieces like this. Even a real human being doesn't understand discreet fragments of otherwise comprehensible human language. It is only by looking language as a whole that we human get the understanding, so spreading language processing out through a number of websites wouldn't work...
Plus this kind of "service" would be very fragile even the cases it would otherwise work...
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"
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).
Also, it handles time ranges, subject, verb, multiple time selections, and timezones of the person you're scheduling with. I've been using it for a long time already and it's pretty good at handling crazy stuff like:
"Meet with sam@gmail.com and jim@gmail.com next wednesday from 3pm to 9pm or first thursday of next month from 4pm to 8pm"
This creates an event that allows sam & jim to choose between these 2 dates. If presdo had an api to extract this information, I'd be on board!
While we're on the topic, anyone know of a clean Python library for converting local to UTC (that knows about DST)? For example, I'd like to specify a timezone, a local time, and a date, and get a UTC datetime.
In concrete terms, if I know that something is happening at 730pm four months from now in a city that's currently in EDT, suggestions on how to get a UTC for that?
http://github.com/fizx/date_range/blob/459812f091a67ce8d4b0e...
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.