matthewmueller / date

Date() for humans
http://matthewmueller.github.io/date/
1.48k stars 88 forks source link

Fixes with NLP #74

Open kengz opened 8 years ago

kengz commented 8 years ago

@matthewmueller I'm writing a time parser using NLP; did the math proofs but the implementation is taking longer than expected. Since it requires the entire rewriting of the codebase, I'm developing it separately.

In the meantime I'm pulling part of the results to fix yours since I badly need a working time parser now. Hopefully the merger is elegant enough and I can complete the full NLP-based time parser within your repo, since it already has a userbase.

I'll be sending some pull requests soon to fix multiple open issues. Oh and let me know what you think - if it's okay to slowly merge the NLP-based implementation under this repo. Thanks.

kengz commented 8 years ago

@matthewmueller Just submitted the second PR #78.

Question: would it be okay if I overwrite the original datejs default behavior, for example 'tomorrow' would be the next day, defaulted to 9am if no time is mentioned?

The Context-Free Grammar (CFG) implementation of what I dub the Human Language for Time is based on a simple mathematical/computational proof I did earlier. The implementation is mostly complete in PR #78, but I'm suppressing its full features due to:

  1. the question above (overriding default behaviors, sensible of course)
  2. pending features: leap year, properly carry days across months due to different number of day,

Once I get a green light and resolve them, I'll restore the full features of the CFG, which is able to extract time from any context-free natural language. As for the formal proof if any one wants it, I will attach after I finish the implementation and some adjustments.

The CFG also includes a next phase that naturally generalizes to provide range and cron. That would be the next phase.

For now I have to get back to work, so will put this off a bit.

kengz commented 8 years ago

quick update: ehh a bit busy lately but I'm getting to the part where I use the time parser soon, so expect to resume work on that then :)