Locale support for dates and times

The Wit.ai Team
Oct 23, 2017 · 1 min read

Today, we are adding locale support to improve detection and resolving of date and time expressions.

Context is key in NLP. This is especially true when trying to understand dates or locations. For instance, “today” will be interpreted as differently depending on the timezone of the user: the same absolute time may be the 17th in San Francisco and the 18th in Hong-Kong.

You can already pass reference_time or timezone as context to help resolve dates and times. Starting today you can also provide a locale.

Depending on what country your user is from, the same sentence may mean different things.
“remind me on 11/12” means Nov 12th in the US but Dec 11th for our mates in the UK!
Similarly, “Thanksgiving 2017” means November 23rd in the US, while it means October 9th to a Canadian.

If the user locale is supported by Duckling, our open-source linguistic parser, Wit will use it to deliver the correct result for your user. If a locale is not yet available in Duckling, it will default to the “parent” language with no locale-specific customizations. We welcome contributions from the community to help us improve our coverage of various locales. Head over to our GitHub repository to contribute!

Here is an example of calling Wit passing the “en_GB” locale:

curl \
-H 'Authorization: Bearer $WIT_ACCESS_TOKEN' \
'https://api.wit.ai/message?v=20171018&q=remind%20me%20on%2011%2F12&context=%7B%22locale%22%3A%22en_GB%22%7D'
{"msg_id":"0Wo02v2lMNlNtmSQW","_text":"remind me on 11\/12","entities":{"datetime":[{"confidence":0.9668475,"values":[{"value":"2017-12-11T00:00:00.000-08:00","grain":"day","type":"value"},{"value":"2018-12-11T00:00:00.000-08:00","grain":"day","type":"value"},{"value":"2019-12-11T00:00:00.000-08:00","grain":"day","type":"value"}],"value":"2017-12-11T00:00:00.000-08:00","grain":"day","type":"value"}]}}As always, feel free to reach out if you have any questions, comments, or suggestions!Team Wit

Wit.ai

Wit.ai makes it easy for developers to build applications and devices that you can talk or text to. Our vision is to empower developers with an open and extensible natural language platform. We'll use this blog to share news, feature announcements and stories from our community.

    The Wit.ai Team

    Written by

    The people behind Wit

    Wit.ai

    Wit.ai

    Wit.ai makes it easy for developers to build applications and devices that you can talk or text to. Our vision is to empower developers with an open and extensible natural language platform. We'll use this blog to share news, feature announcements and stories from our community.

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade