zoho / hawking

A Natural Language Date Time Parser that Extract date and time from text with context and parse to the required format

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A couple of edge cases don't appear to be coming through correctly

MattRiddell opened this issue · comments

can someone come out this weekend in the afternoon

Text: this weekend
ID: 0
IsExactTimePresent: No
Start: Saturday, October 9, 2021 at 1:00:00 AM EDT
End: Monday, October 11, 2021 at 12:59:59 AM EDT
Text: afternoon
ID: 0
IsExactTimePresent: No
Start: Wednesday, October 6, 2021 at 1:00:00 PM EDT
End: Wednesday, October 6, 2021 at 5:59:59 PM EDT

do you have any availability next week sometime in the morning?

Text: next week
ID: 0
IsExactTimePresent: No
Start: Sunday, October 10, 2021 at 1:00:00 AM EDT
End: Sunday, October 17, 2021 at 12:59:59 AM EDT
Text: morning
ID: 0
IsExactTimePresent: No
Start: Thursday, October 7, 2021 at 2:00:00 AM EDT
End: Thursday, October 7, 2021 at 12:59:59 PM EDT

I guess the problem is when there are compound statements.

Do you think this is something we could do with hawking or do some external parsing in these cases?

It looks like I can get at it with the recognizer labels. Is this how you'd do it?

for (com.zoho.hawking.language.english.model.RecognizerOutput ro: parserOutput.getRecognizerOutputs()) {
  output.put("RecognizerLabel",ro.getRecognizerLabel());
}

This gets me JSON like this:

[
  {
    "Time Zone": "+00:00",
    "IsTimeZonePresent": false,
    "IsExactTimePresent": false,
    "Start Index": 21,
    "EndTime": "2021-10-10T23:59:59.000Z",
    "RecognizerLabel": "week_span",
    "Label": "D",
    "End Index": 33,
    "StartTime": "2021-10-09T00:00:00.000Z",
    "Text": "this weekend",
    "Id": 0,
    "Match Type": ""
  },
  {
    "Time Zone": "+00:00",
    "IsTimeZonePresent": false,
    "IsExactTimePresent": false,
    "Start Index": 41,
    "EndTime": "2021-10-07T16:59:59.000Z",
    "RecognizerLabel": "part_of_day",
    "Label": "D",
    "End Index": 50,
    "StartTime": "2021-10-07T12:00:00.000Z",
    "Text": "afternoon",
    "Id": 0,
    "Match Type": ""
  },
  {
    "Expression": "(0)",
    "Sequence": "SINGLE"
  },
  {
    "Expression": "(0)",
    "Sequence": "SINGLE"
  }
]
commented

Hi @MattRiddell,
for the given input cases, the current model would fail as this is a complex case, hawking is designed to solve compound dates like "next year 1st weekend Sunday morning 9 am".

these cases are new for hawking, considered to be advance cases and the context of the date and time is also complex to return a particular date-time value.

Case 1:
"this weekend in the afternoon" is the single date text present, but what will be the expected output for this input?

   "this weekend" refers to "Saturday and Sunday", 
   "in the afternoon" refers to what? Saturday's afternoon or Sunday's afternoon or afternoon of both days.
   this might be different based on the user's perspectives. 

Case 2:
"next week sometime in the morning?" is the single date text present, it is also similar to the previous one, Current version of hawking will return obvious date and time mentioned in the text, these cases are complex to decide and return meaning full date and time value.

we will have these as future cases as enhancement and make hawking return reasonable output as single date and time.

Let us know in case of any other doubts or clarifications.

It seems to be returning day and week span pieces which I've been able to piece together to form what I'm looking for. Thanks again for an awesome library. I think we have a couple of other use cases to run by you but for the moment I'll close this out. Thanks again!

commented

@MattRiddell yeah definitely, Reach us for any date-time-related cases and clarifications, we are happy to help you.