Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time intervals are too large by one grain #726

Open
noblepreplan opened this issue Dec 6, 2023 · 1 comment
Open

Time intervals are too large by one grain #726

noblepreplan opened this issue Dec 6, 2023 · 1 comment

Comments

@noblepreplan
Copy link

noblepreplan commented Dec 6, 2023

I'm seeing what appears to be some kind of bounding issue in Duckling when calling the API parse function. I'll fire off a request and get the expected response, except that the duration is too long. A few examples:

[{"body":"today 2PM to today 3PM","start":0,"value":{"values":[{"to":{"value":"2023-12-06T16:00:00.000-08:00","grain":"hour"},"from":{"value":"2023-12-06T14:00:00.000-08:00","grain":"hour"},"type":"interval"}],"to":{"value":"2023-12-06T16:00:00.000-08:00","grain":"hour"},"from":{"value":"2023-12-06T14:00:00.000-08:00","grain":"hour"},"type":"interval"},"end":22,"dim":"time","latent":false}]

[{"body":"today 4PM to today 4:30PM","start":0,"value":{"values":[{"to":{"value":"2023-12-06T16:31:00.000-08:00","grain":"minute"},"from":{"value":"2023-12-06T16:00:00.000-08:00","grain":"minute"},"type":"interval"}],"to":{"value":"2023-12-06T16:31:00.000-08:00","grain":"minute"},"from":{"value":"2023-12-06T16:00:00.000-08:00","grain":"minute"},"type":"interval"},"end":25,"dim":"time","latent":false}]

[{"body":"today 4PM to today 5:15PM","start":0,"value":{"values":[{"to":{"value":"2023-12-06T17:16:00.000-08:00","grain":"minute"},"from":{"value":"2023-12-06T16:00:00.000-08:00","grain":"minute"},"type":"interval"}],"to":{"value":"2023-12-06T17:16:00.000-08:00","grain":"minute"},"from":{"value":"2023-12-06T16:00:00.000-08:00","grain":"minute"},"type":"interval"},"end":25,"dim":"time","latent":false}]

In each case we can see that the duration is too long by the value of one grain, whether that be an extra hour or an extra minute. It's as if Duckling is inclusive on both ends of the duration and then uses a ceiling function to round it up. Maybe I'm missing a configuration option or an API option to prevent this behavior, but I'm not seeing anything outright. Is there something I can do to prevent this?

I'm also seeing this if I try to use "between 2PM and 3PM". I get a 2 hour block instead. The rules file for EN Time seems to indicate that this should be a closed interval if I'm reading it correctly, so we shouldn't be seeing the extra grain as it should be an exclusive endpoint.

@chessai
Copy link
Contributor

chessai commented Jan 22, 2024

duckling bounds are upper-exclusive. this is not a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants