I am currently using duckling in my Rasa application to help me extract dates from user inputs. However, I recently ran into an issue with the date extraction and am unsure on how to fix the issue or why the issue occurs.
The Issue: Duckling incorrectly parses relative dates with positional key words like “last” or “this” by a very large margin.
Let’s say the date is Tuesday, October 6th, 2020 PDT.
If the text is “What is the date 22 weeks from this friday”, Duckling returns
2021-03-12T00:00:00.000-08:00 which is correct.
If the text is “What is the date 22 weeks from friday”, Duckling returns
2020-12-18T00:00:00.000-08:00, which is incorrect. Counting back, it looks like Duckling used July 17th, 2020 as the starting point.
Similarly, if the text is “what is the date 10 years from friday”, Duckling returns
2030-07-17T00:00:00.000-07:00 which is incorrect. We can see that here, Duckling used July 17th, 2020 as a starting point again.
My question is, what is the significance of July 17th? Why is it the date used when key words such as “this”, “last” and “next” are not used in conjunction with Friday? And how can I go about this issue? Any insight is appreciated.
This bug can be replicated on my local docker-compose setup, on the AWS cloud, and when I spin up Duckling as a standalone container locally and send a request to it. The grains that Duckling sends back are also way off the mark.
Duckling image: rasa/duckling:0.1.6.3 (latest)
If you want to try it out, you can run a duckling container locally and send a cURL request to it like this:
docker run -p 8000:8000 rasa/duckling
curl -XPOST http://0.0.0.0:8000/parse --data 'text=22 weeks from friday'
curl -XPOST http://0.0.0.0:8000/parse --data 'text=22 weeks from this friday'