snipsco / snips-nlu

Snips Python library to extract meaning from text
https://snips-nlu.readthedocs.io
Apache License 2.0
3.89k stars 513 forks source link

How to use a specific timezone when resolving date/time values? #862

Open rp4fx12 opened 4 years ago

rp4fx12 commented 4 years ago

Question

Is there a way to specify a timezone when using snips for predictions? I'm currently trying to test out cases where snips may be running on a server using utc and has to resolve a query from someone in a different timezone. The concept of tomorrow may change between those timezones. While tomorrow can be converted back to the query timezone, it becomes harder if the query specifies a specific day of the week such as Wednesday. If the current day is Tuesday on the query timezone (assume EDT) and the server timezone is Wednesday (because it is ahead - UTC), then Wednesday returned will be a week ahead when it should be the next day for the query timezone. Do you know what I can do for this?

adrienball commented 4 years ago

Hi @rp4fx12 This is a limitation that we are aware of, and which should definitely be addressed. More generally, the objective would be to allow to specify a "time context", which would be a reference time along with a timezone, to the parsing API so that the datetime resolution can be controlled precisely and does not depend on the machine it is running on.

I will try to allocate some time before the end of the year to tackle this. The amount of work is reasonable but two dependencies must be updated on top of snips-nlu, which makes this change difficult to crowdsource to the community.