On Sun, Feb 04, 2018 at 04:04:34PM +0100, Nicolas George wrote:
All you describe is convenience for programmatic use. As I explained,
this parser is meant for interactive use. For interactive use,
flexibility and natural language are a convenience.


And you keep ignoring the fact that actual humans have trouble getting the results they want because as nice as the idea of natural language parsing is, it doesn't actually work reliably. If you have a couple of canned inputs you use routinely, you're not actually making use of the natural language parsing, you're using an obscure grammar that could easily be replaced by a different grammar.

Alternatively, instead of just repeating over and over that natural language parsing is convenient, please show the variety of date strings with which you make use of the full range of natural language parsing that has been implemented in date(1). Having watched people using date(1) for 20 years, I can say quite reliably that most people just find something that works and use it over and over--getting results in spite of the NLP, not because of it. Generally they find the thing that works by googling and copying, not by writing an arbitrary english sentence and seeing the expected results appear as if by magic.

Heck, let's try some natural language right now:

date
Sun Feb  4 10:30:42 EST 2018

date -d 'what was the date last week'
date: invalid date ‘what was the date last week’

date -d 'date last week'
date: invalid date ‘date last week’

date -d 'day last week'
Mon Jan 29 10:30:53 EST 2018

^^^ well, that's not they day it was last week. that's last week plus one day. explainable, not necessarily predictable.

date -d 'last week'
Sun Jan 28 10:31:33 EST 2018

^^^ well, you can get the date out of that, but IMO it's less "natural" and more "Og the cave man"

date -d 'month from now'
date: invalid date ‘month from now’

^^^ bummer, I really thought that might work

date -d 'month'
Sun Mar  4 10:33:21 EST 2018

^^^ Og the cave man strikes again

date -d '2 months ago'
Mon Dec  4 10:34:05 EST 2017

^^^ ooh, this one almost seems like natural language, I must be getting the hang of it

date -d '2 months and 2 days ago'
date: invalid date ‘2 months and 2 days ago’

^^^ whomp-whomp. what if I take out the "and"?

date -d '2 months 2 days ago'
Mon Apr  2 11:35:18 EDT 2018

^^^ WTF? Oh, it's 2 months in the future, minus 2 days. Wait, now I have another guess about what might work!

date -d '2 months ago 2 days ago'
Sat Dec  2 10:37:11 EST 2017

^^^ Totally natural!

date -d 'today - 2 months - 2 days'
Sat Dec  2 10:39:23 EST 2017

^^^ Hmm. Maybe it would be easier to just dump all the "ago" stuff and have a short list of keywords and operators? No, let's just keep going with this natural language stuff, it's much more convenient.

date -d 'first tuesday'
Tue Feb  6 00:00:00 EST 2018
date -d 'third tuesday'
Tue Feb 20 00:00:00 EST 2018
date -d 'second tuesday'
Tue Feb  6 00:00:01 EST 2018

^^^ Explainable, not predictable! So it must be that "first tuesday" means the first tuesday in the month, but "second tuesday" sadly means the first tuesday plus one second because "second" has more than one meaning and I wanted the other one. Oh well, at least I've figure it out.

date -d 'first thursday'
Thu Feb  8 00:00:00 EST 2018

^^^ WTF? Oh, so it isn't the first thursday in the month, it's the first thursday in the week. I guess that's useful. So "third tuesday" must have meant "the third tuesday in the week". That makes sense.

Mike Stone

Reply via email to