neilgupta/Sherlock

Allow for general time related terms (ex: lunch time)

Closed this issue · 4 comments

Try to enter There will be a meeting tomorrow after lunch on the demo page

Ah, right now it’s interpreting the time as “after tomorrow.” What would be the expected output of this sentence? We could alias “lunch” to 12pm, but “after lunch” would still be any range from 8/17/2017 12pm - 1/1/3000 12am without an end time. Similarly, “before lunch” would give us an end time but no start time, so I don’t see that being very helpful. Another problem is that the standard time for breakfast, lunch, and dinner could vary a lot between people and cultures, I’m not sure.

Having said that, it’s fairly trivial to alias breakfast to 9am, lunch to 12pm, and dinner to 6pm if that solves your problem.

How about if there isn't a defined time span, the duration is set to 0?
Aka: After lunch would result in a start time of 12 o'clock and an end time of 12 o'clock.

This effectively makes lunch an alias for noon. I'd rather not hardcode that into Sherlock because meal times are often culture-specific, but this could easily be added via Watson's preprocessor. Something like the following code should get what you want:

preprocess: function(str) {
    str = str.replace('lunch', '12pm');
    str = str.replace('dinner', '6pm');
    return [str, {}];
}

Closing this issue since I think Watson solves the problem sufficiently. Let me know if you disagree!